android - (Android) ParsePushBroadcastReceiver 的子类不会在推送通知时被调用。 (parse.com)

标签 android parse-platform

我试图覆盖从 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/

相关文章:

ios - 如何查询用户区域之外的帖子? (parse.com)(迅速)

mongodb - 将 Parse.com 应用程序迁移到 AWS EC2 Ubuntu 时出现的问题

android - Crashlytics 弃用 logException() 替代品是什么?

android - Toast 取消不起作用

android - 解析推送 : Subscribe Android app to more than one Parse app

javascript - 变量未定义 Javascript + Parse.com

javascript - 解析API请求计数和批处理: saveAll() destroyAll() etc

java - eclipse运行后老是崩溃

android - 构造函数 Geocoder() 未定义

android - 怎么去掉通知栏的短信图标