【发布时间】:2019-05-27 21:41:08
【问题描述】:
当我的 android 应用程序被杀死时,我的 android 应用程序没有收到任何 firebase 通知,FirebaseMessagingService 在我关闭应用程序时被操作系统杀死。当应用程序位于前台或后台时,一切正常。当应用程序在后台并且我发送一条数据消息时,onMessageReceived() 在我的FirebaseMessagingService 中接收到它(有趣的是,它是为每条消息创建然后销毁的,即FirebaseMessagingService)。
当我终止应用程序(通过从打开的应用程序列表中滑动)时,onMessageReceived() 中不再收到消息。所有服务都被杀死!
谁能帮帮我吗?提前致谢!
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<!-- DefaultOrderedBroadcastReceiver will start this service to send notifications to system tray -->
<service
android:name=".fcm.SystemTrayNotificationsSenderIntentService"
android:enabled="true"
android:exported="false" />
<!-- the FCM receiver service -->
<service
android:name=".fcm.FCMNotificationReceiverService"
android:exported="true"
android:stopWithTask="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name=".fcm.chat.FCMChatOfflineMessagesNotificationJobSchedulerService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
【问题讨论】:
-
你是奥利奥还是以上?
-
您在
AndroidManifest.xml中注册了BroadcastReceiver吗? -
@IshitaSinha 是奥利奥!!
-
@ReazMurshed 是的,一切正常,当应用程序关闭或 FirebaseMessagingServices 被杀死时出现问题,它只是不再收到通知了!!
标签: android firebase firebase-cloud-messaging xmpp gsm