My android app is not receiving any firebase notification when the app is killed, the FirebaseMessagingService
gets killed by the operating system when I close the application. Everything works fine when the app is in the foreground or in the background. When the app is in the background and I send a data message it's received by onMessageReceived()
in my FirebaseMessagingService
(which interestingly is created and then destroyed for each message i.e. FirebaseMessagingService
).
When I kill the app (by swiping from open app list) messages are no longer received in onMessageReceived()
. All services get killed!!
Can anyone please help me? Thanks in advance!
<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" />