如何检测点击解析通知?

How detect clicking parse notification?

我在我的应用程序中使用解析推送通知。 当我向我的仪表板中的所有设备发送消息时,我无法在使用单击通知时获得传递推送。 有什么方法可以检测到吗?

发送和接收推送时,ParsePushBroadcastReceiver 会调用适当的方法。你应该像这样编写自己的自定义 class 来覆盖原始的 ParsePushBroadcastReceiver。

public class CustomParsePushBroadcastReceiver extends ParsePushBroadcastReceiver {
@Override
protected void onPushOpen(Context context, Intent intent) {
    super.onPushOpen(context, intent);
    //Called when the push notification is opened by the user.
    Log.wtf(TAG, "Opened!");

...如果需要,请实施其他方法

具体来说,当用户点击通知时会调用onPushOpen。​​

此外,不要忘记像这样class更新自定义清单

<receiver android:name=".CustomParsePushBroadcastReceiver" 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>

并确保您已调用 ParsePush.subscribeInBackground(""),其中参数是您要订阅的频道(将其留空会订阅所有我相信的内容)。