FCM notification message are not received in android Oreo version?

前端 未结 9 1624
轻奢々
轻奢々 2021-02-18 13:31

I have send FCM notification from server to users. It works fine(until api 25) but in Oreo when the application have not in background(services are closed) (or) completely close

9条回答
  •  有刺的猬
    2021-02-18 14:16

    only data notifications is handled on android Oreo

    try to remove the notification

    `
     remove this key notification 
     {"notification":
     {
      "title": "notification_title",
      "body": "notification_body"
     },
     // keep only the data key 
      "data":
     {
      "example":"hey",
      "example2":"you need me."
     },
    
     "priority" : "high",
    
     "registration_ids":
        []
    
    
    `
    

    when the app is in background .. the onRecievedMessage will not called if the payload is contains both notification key and data key ..

    so remove the notification .. and only keep the data key .. and it will work well

提交回复
热议问题