Android Parse.com:在onPushOpen上获取Pushnotification消息

Android Parse.com:在onPushOpen上获取Pushnotification消息,android,parse-platform,push-notification,Android,Parse Platform,Push Notification,在我的android应用程序中,我使用Parse.com提供的推送通知。我已经成功地实现了这一点,但是我的应用程序有多个推送通知,并且应该根据按下的推送通知加载不同的活动。我希望能够从onPushOpen的intent参数中获取推送通知的消息,但它似乎是空的。有人知道我如何用onPushOpen方法获取消息吗 对于某些上下文,我在下面添加了我当前的自定义PushReceiver代码 public class PushReceiver extends ParsePushBroadcastRecei

在我的android应用程序中,我使用Parse.com提供的推送通知。我已经成功地实现了这一点,但是我的应用程序有多个推送通知,并且应该根据按下的推送通知加载不同的活动。我希望能够从onPushOpen的intent参数中获取推送通知的消息,但它似乎是空的。有人知道我如何用onPushOpen方法获取消息吗

对于某些上下文,我在下面添加了我当前的自定义PushReceiver代码

public class PushReceiver extends ParsePushBroadcastReceiver {

    @Override
    public void onPushOpen(Context context, Intent intent) {
        Log.e("Push", "Clicked");
        Intent i = new Intent(context, Splash.class);
        i.putExtras(intent.getExtras());
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        context.startActivity(i);
    }
}

谢谢。

请确保已升级到Parse-1.8.2

然后你还需要做两件事

  • 将信息添加到您的AndroidManifest.xml(内)

    
    
  • 将其添加到标记外部的AndroidManifest.xml

  • 在Parse.com上的云代码中,将广播的uri设置为“com…ADD\u PACKAGE\u INFO\u HERE…PushReceiver”

  • 注意:当您运行android应用程序时,应在调试跟踪中为您提供#1和#2

    希望这有帮助。我花了几个小时试图让它工作,我的关键是更新到1.8.2

    编辑: 您还应该研究覆盖onReceive和onPushOpen…这两个函数实际上在通知中被调用。祝你好运

    <service android:name="com.parse.PushService" />
    <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="com...ADD_PACKAGE_INFO_HERE..." />
        </intent-filter>
    </receiver>
    
    <receiver android:name="com..ADD_PACKAGE_INFO_HERE....PushReceiver"
              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>