【发布时间】:2018-06-20 07:29:13
【问题描述】:
我更新了 parse sdk,这迫使我从 GCM 迁移到 FCM。我已经关注了这个链接: https://github.com/codepath/android_guides/wiki/Push-Notifications-Setup-for-Parse
当应用程序正在运行或处于后台时,我能够收到推送通知,但在应用程序被终止时无法接收。
这是我的 AndroidManifest.xml :
<service
android:name="com.parse.fcm.ParseFirebaseInstanceIdService"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service
android:name="com.parse.fcm.ParseFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
<receiver
android:name=".receiver.CustomParsePushReceiver"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.RECEIVE_BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.OPEN" />
<action android:name="com.parse.push.intent.DELETE" />
</intent-filter>
</receiver>
CustomParsePushReceiver.java
public class CustomParsePushReceiver extends ParsePushBroadcastReceiver {
@Override
protected void onPushReceive(Context context, Intent intent) {
Log.e("ParsePushReceiver","Parse receiver received notification");
}
}
我已将 parse server、parse sdk、parse-fcm、firebase-core 和 firebase-messaging 更新到最新版本。
【问题讨论】:
-
推送消息的优先级(正常或高)。当推送通知传入时,您是否有一些 FJD 或 JobIntentService 来唤醒应用程序?还要检查firebase.google.com/docs/cloud-messaging/concept-options
-
在 .receiver.CustomParsePushReceiver 上发布您的代码
-
我只是登录customparsepushreceiver
-
应用下面的答案,它会工作
标签: android firebase parsing push-notification firebase-cloud-messaging