In normal case app is alive i received the notification and i display it.
{
"to" : "xxxx",
"notification": {
"body": "Hello",
"title" : "Hello world notification"
},
"data" : {
"data1" : "dddddd",
"data2" : "mmm"
}
}
<service
android:name=".notifications.MyFirebaseMessagingService"
android:directBootAware="true"
android:exported="false"
android:enabled="true"
android:stopWithTask="false"
>
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
Since severals days i search a solution to receive notification FCM when my app is not alive.
I try to FirebaseMessagingService / stopWithTask Create other service to manage FirebaseMessagingService etc.
But i don't found a good way and good practice and technical solution.
Finally it not possible to receive notification when app if not alive?
what is the good way to keep app in background and not really killed app when the user swipe?
(i use API 29)
add this code in your Manifest file OnMessageRecive not call if App is background refer this document
https://firebase.google.com/docs/cloud-messaging/android/topic-messaging