【发布时间】:2014-07-21 15:26:06
【问题描述】:
我想处理推送通知而不在通知栏中显示它,Parse.com 默认会这样做。
Parse.com 需要清单中的条目,因此我无法将其更改为我自己的BroadcastReceiver,因为它不起作用。
<receiver android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND"
android:priority="1">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="packagename" />
</intent-filter>
</receiver>
所以我所做的是为相同的IntentFilter 创建第二个接收器,但具有更高的优先级。
<receiver android:name="packagename.ParseComPushReceiver"
android:permission="com.google.android.c2dm.permission.SEND"
android:priority="2">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="packagename" />
</intent-filter>
</receiver>
然后我尝试中止广播
@Override
public void onReceive(final Context context, final Intent intent) {
abortBroadcast();
// handle here
}
但不幸的是,我仍然在通知栏中看到“收到通知”通知。
【问题讨论】:
标签: android push-notification parse-platform google-cloud-messaging