我对Android还比较陌生,希望你们能轻松解决我的问题!
我想让用户在按下应用程序上的按钮后向其他用户发送推送。我已经正确配置了ParsePush按钮点击监听器,因为这个功能很好:
// Create our Installation query
ParseQuery pushQuery = ParseInstallation.getQuery();
pushQuery.whereEqualTo("installationId", installationId); //Send to targeted user
// Send push notification to query
ParsePush push = new ParsePush();
push.setQuery(pushQuery); // Set our Installation query
push.setMessage("HEY YOU");
push.sendInBackground();
我想在推送中添加一个URI,于是我执行了以下操作:
// Create our Installation query
ParseQuery pushQuery = ParseInstallation.getQuery();
pushQuery.whereEqualTo("installationId", installationId);
// Send push notification to query
ParsePush push = new ParsePush();
push.setQuery(pushQuery); // Set our Installation query
String string = "{\"title\" : \"my title\",\"alert\" : \"my alert text\",\"uri\" : \"myapp://host/path\"}";
try {
JSONObject data = new JSONObject(string);
push.setData(data);
} catch (JSONException e) {
Log.e("MYAPP", "unexpected JSON exception", e);
}
push.sendInBackground();
在我的Android清单文件中,我有一个目标活动:
<activity android:name=".Accept_Action">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" android:host="host" android:path="/path" />
</intent-filter>
</activity>
但是出于某些原因,这不起作用。 推送从未到达我的目标设备。 你能帮我让它起作用吗? 谢谢