Firebase Expandable Notification Show image when app is in background

前端 未结 12 2060
深忆病人
深忆病人 2020-12-23 14:19

I am implementing FCM notifications in Android, but how does notifications differ depending on the app status (background vs. foreground)?

12条回答
  •  [愿得一人]
    2020-12-23 14:38

    If your expecting only one notification in a system tray for your app then the below solution can solve the problem, until FCM comes up with proper solution.

    1. remove MyFirebaseMessagingService from manifest.

              
      
    2. MyGcmReceiver Extend GcmReceiver class and right the notification logic.
    3. Add MyGcmReceiver in manifest

          
          
              
              
          
      
      
    4. cancelAll notifications before notifying the notification. (Otherwise firebase also, shows notification when app is in background)

提交回复
热议问题