【发布时间】:2016-05-12 08:55:27
【问题描述】:
在 Parse 控制台中,它显示交付报告为成功,但根本没有调用 onPushReceive。我在这里想念什么?任何帮助,将不胜感激。
下面是我的代码。 清单代码:
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.appname" />
</intent-filter>
</receiver>
<service android:name="com.parse.PushService" />
<receiver android:name="com.appname.PushReceiver"
android:permission="com.google.android.c2dm.permission.SEND"
android:exported="false">
<intent-filter>
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.OPEN" />
<action android:name="com.parse.push.intent.DELETE" />
</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" />
<!--IMPORTANT: Change "com.parse.starter" to match your app's package name.-->
<category android:name="com.appname" />
</intent-filter>
</receiver>
PushReceiver 类:
public class PushReceiver extends ParsePushBroadcastReceiver
{
@Override
protected void onPushReceive(Context context, Intent intent) {
super.onPushReceive(context, intent);
Log.v("Push Receive called...", "");
if (intent == null)
return;
try
{
JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data"));
} catch (JSONException e) {
e.printStackTrace();
}
}
}
【问题讨论】:
-
您的 google-services.json 中可能有问题
-
解析已关闭。你应该转移到另一个服务。
-
@DevendraSingh 是的,我知道,这只是几个月的临时解决方案。
-
看link第二步
-
google-services.json 文件看起来不错。
标签: android parse-platform push-notification