In my app I need to notify user with a custom calling-type screen where he have to respond to an important business decision, its so important that he dint mind the bad user experience it can cause.
I use FCM data message, but the onRecieve method is not triggered when the app is swiped away from current apps list in devices below 6.0 .
Now I am using a service that starts a broadcast listener to listen received message, app is working as expected when its foreground/background, but once its swiped out, the service stops as the app is killed, but in devices above 6.0 app is not killed by swipe , this is my observation till now.
Basically what I am looking for is a service that can run even if your app is swiped away. I am aware of START_STICKY
things, it doesn't help. Please help me.
You should just implement FCM as described in the documentation and onMessageReceived()
should be called every time a data-message arrives (even if the app is killed or swiped away).
If the app doesn't receive the message if the app is swiped away it means that you have device that has a non standard version of Android installed.
Unfortunately on those devices this is NOT the only problem your app is going to have.
My suggestion is to contact the manufacturer and explain them that their customization are breaking the Android API.
More info: Push notifications using FCM not received when app is killed android