Android Parse.com禁用推送通知

Android Parse.com禁用推送通知,android,push-notification,parse-platform,google-cloud-messaging,Android,Push Notification,Parse Platform,Google Cloud Messaging,我想处理推送通知而不在通知栏中显示它,Parse.com默认情况下就是这样做的 Parse.com需要清单中的条目,因此我无法将其更改为我自己的BroadcastReceiver,因为它不起作用 <receiver android:name="com.parse.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" andr

我想处理推送通知而不在通知栏中显示它,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>
在那里,我试图中止广播

@Override
public void onReceive(final Context context, final Intent intent) {
    abortBroadcast();
    // handle here
}

但不幸的是,我仍然可以在通知栏中看到“Notification received”通知。

您可以使用自己的自定义广播接收器进行解析。它记录在推送指南中

具体而言,替换:

    <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>

我不知道如何让这个方法在从web控制台发送而不是从设备构造的推送中工作,因此默认的“Notification Received”消息仍然不断出现

对我有效的方法是将android:exported=“false”添加到parse.com条目中,如下所示:

    <receiver
        android:name="com.parse.GcmBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND"
        android:exported="false">
        <intent-filter>
            <action android:name="com.example.DISABLE_PARSE_PUSH" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="com.example" />
        </intent-filter>
    </receiver>
    <service android:name="com.parse.PushService" />


这将禁用默认通知。

谢谢。我已经多次阅读了有关接收和处理推送的文档,但不知何故忽略了这一点。是否有必要使用此实现注销此接收器。如果是,在哪里进行?
  <receiver
        android:name="com.example.MyCustomReceiver"
        android:exported="false">
        <intent-filter>
            <action android:name="com.example.UPDATE_STATUS" />
            <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>
public class MyCustomReceiver extends ParsePushBroadcastReceiver {
private static final String TAG = "MyCustomReceiver";

  @Override
  public void onReceive(Context context, Intent intent) {
    try {
      String action = intent.getAction();
      String channel = intent.getExtras().getString("com.parse.Channel");
      JSONObject json = new JSONObject(intent.getExtras().getString("com.parse.Data"));

      // Custom behavior goes here

    } catch (JSONException e) {
      Log.d(TAG, "JSONException: " + e.getMessage());
    }
  }
}
    <receiver
        android:name="com.parse.GcmBroadcastReceiver"
        android:permission="com.google.android.c2dm.permission.SEND"
        android:exported="false">
        <intent-filter>
            <action android:name="com.example.DISABLE_PARSE_PUSH" />
            <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
            <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            <category android:name="com.example" />
        </intent-filter>
    </receiver>
    <service android:name="com.parse.PushService" />