Notification not receive when Application terminated in android

53
October 09, 2019, at 2:50 PM

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.

READ ALSO
How do I connect an Azure MySQL Database to my iOS and Android App

How do I connect an Azure MySQL Database to my iOS and Android App

Entirely new to this and was hoping to find some reasonably straightforward API's or documentation to connect the MySQL database I have on Azure to the iOS and Android apps I have in development

22
why Dialog doesn't show in Kotlin?

why Dialog doesn't show in Kotlin?

I want to create a Dialog window when I click the Floating Action ButtonBut, when I click the button, just appears the Toast message

36
How to custom claims token to firebase firestore rules via Android App?

How to custom claims token to firebase firestore rules via Android App?

I'm trying to customize claims token to firestore rule via Cloud Functions but it do not appear a good solution because it throws an exception when I try create an user via Android Application like follow:

41
Cordova ble.write i can't send data (Android)

Cordova ble.write i can't send data (Android)

this function writes data to a characteristic

13