问题描述
这是我的code派在Android中使用parse.com推送通知。
ParseQuery installQuery = ParseInstallation.getQuery();\r
installQuery.whereEqualTo(用户id,recieverObjectID);\r
\r
\r
\r
\r
ParsePush androidPush =新ParsePush();\r
androidPush.setMessage(currentUser.getUsername());\r
androidPush.setQuery(installQuery);\r
androidPush.sendInBackground();
\r
在模拟器我能够发送和接收推送通知,但我无法接收设备推送通知。我设法找回在解析安装表时,手推式的GCM这些设备或仿真器推送通知不被发送。指导我用的解决方案。
首先做到这一点:
ParsePush androidPush =新ParsePush();
androidPush.setMessage(currentUser.getUsername());
androidPush.setQuery(installQuery);
androidPush.saveInBackground();
检查你的清单,然后按u缺少一些权限可以是Internet的权限或如下:
然后在应用程序标签:
<服务机器人:名字=com.parse.PushService/>
<接收机器人:名字=com.parse.ParseBroadcastReceiver>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.BOOT_COMPLETED/>
<作用机器人:名字=android.intent.action.USER_ preSENT/>
&所述; /意图滤光器>
< /接收器>
<接收机器人:名字=com.parse.GcmBroadcastReceiver
机器人:权限=com.google.android.c2dm.permission.SEND>
&所述;意图滤光器>
<作用机器人:名字=com.google.android.c2dm.intent.RECEIVE/>
<作用机器人:名字=com.google.android.c2dm.intent.REGISTRATION/>
<类机器人:名字=你的包NAME/>
&所述; /意图滤光器>
< /接收器>
<接收机器人:名字=com.parse.ParsePushBroadcastReceiver机器人:出口=假>
&所述;意图滤光器>
<作用机器人:名字=com.parse.push.intent.RECEIVE/>
<作用机器人:名字=com.parse.push.intent.DELETE/>
<作用机器人:名字=com.parse.push.intent.OPEN/>
&所述; /意图滤光器>
< /接收器>
This is my code to send a push notification using parse.com in android.
ParseQuery installQuery = ParseInstallation.getQuery();
installQuery.whereEqualTo("userId", recieverObjectID);
ParsePush androidPush = new ParsePush();
androidPush.setMessage(currentUser.getUsername());
androidPush.setQuery(installQuery);
androidPush.sendInBackground();
In emulator I am able to send and receive push notifications, but I am not able to receive push notification on device. I manage to retrieve that in Installation table of parse when push-type is gcm for those devices or emulators push notifications are not sent. Guide me with solution.
firstly do this: ParsePush androidPush = new ParsePush(); androidPush.setMessage(currentUser.getUsername()); androidPush.setQuery(installQuery); androidPush.saveInBackground();check your manifest then u are Missing with some permissions can be Internet Permission or given below: then in the application tag:
<service android:name="com.parse.PushService" />
<receiver android:name="com.parse.ParseBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="YOUR PACKAGE NAME" />
</intent-filter>
</receiver>
<receiver android:name="com.parse.ParsePushBroadcastReceiver" android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
这篇关于使用推送通知parse.com没有收到关于设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!