<分区>
当我的 android 应用程序被终止时,我的 android 应用程序没有收到任何 firebase 通知,FirebaseMessagingService
在我关闭应用程序时被操作系统终止。当应用程序位于前台或后台时,一切正常。当应用程序在后台并且我发送一条数据消息时,它被我的 FirebaseMessagingService
中的 onMessageReceived()
接收(有趣的是,它是为每条消息创建然后销毁的,即 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" />