我试图覆盖从 Android 平台上的 Parse.com API 接收推送通知的默认行为。根据 SO 上的各种帖子以及 Parse 的文档 - 我创建了以下类:
public class HHPBroadcastReceiver extends ParsePushBroadcastReceiver {
protected void onPushReceive(Context context,
Intent intent){
Log.d("DMM", "onPushReceive");
}
protected void onPushOpen(Context context, Intent intent) {
Log.d("DMM", "onPushOpen");
}
}
在我的 list 中,我还按如下方式覆盖了接收器:
<!-- <receiver
android:name="com.parse.ParseBroadcastReceiver"
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.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver> -->
<receiver
android:name="com.dreamr.hothalls.HHPBroadcastReceiver"
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.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
收到推送通知后,我的 Receiver 似乎没有被调用 - 通知区域中出现一条通知,单击它会执行默认操作。我的调试消息没有出现在 Logcat 中。
我已无计可施,试图找出最有可能被我忽略的非常简单的东西。
如有任何意见或建议,我们将不胜感激,
干杯,
肖恩
最佳答案
您还必须注册 GCM 广播接收器
<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="us.anyadir.admissiontable" />
</intent-filter>
</receiver>
关于android - (Android) ParsePushBroadcastReceiver 的子类不会在推送通知时被调用。 (parse.com),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29165029/