FCM notification message are not received in android Oreo version?

前端 未结 9 1686
轻奢々
轻奢々 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 13:59

    Then you are sending notifications without data{} object in your json. That's an old bug(?) or like supposed to work like that. If you don't have any data in your notification, then you won't trigger notifications while your app is on foreground.

    Example json:

    "notification":
    {
      "title": "notification_title",
      "body": "notification_body"
    },
    
    "data":
    {
      "example":"hey",
      "example2":"you need me."
    },
    
    "priority" : "high",
    
    "registration_ids":
    [
      "crYjxvFkASE:APA91bGv4GWj9erJ6LsblEzpag5ObkcESEsBthxsJObJ38DhZ3GbSMLlGQK3qS_qvUvrcrg_cqBgCWhBeq1X2wgxO7gmcc_gW0jM4qZYYugF5wraTHwvDKNnjQwn8dpyGEbFMXLOCvE9"
    ]
    

提交回复
热议问题