I use firebase push notification to device token. When app is opening or in foreground I can get notification well. But when app is kill or clear app on current task, I cannot receive notification send.
I have tried on onMessageReceived aleardy at first time work. but now it's not work when killed app.
Code Receive Notification:
class MyFirebaseMessagingService : FirebaseMessagingService() { override fun onMessageReceived(p0: RemoteMessage) { val data = p0!!.data Log.e("AAAAAAAAAAAAA: ","data 111111111111111111111111111111111111111111111111:" + data["key1"]) } }
Post Send notification data: Send to: https://fcm.googleapis.com/fcm/send
Data :
{ "to" : "token key", "data": { "key1" : "value1", "key2" : "value2", "other_key" : true } }
Result, for app is opening, I can receive data well, but when killed I cannot receive data.