Firebase Expandable Notification Show image when app is in background

前端 未结 12 2100
深忆病人
深忆病人 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:55

    In case some lands here in 2019, you can simply add an image field to the notification object:

        {
            notification: {
                title: title,
                body: body,
                image: "http://path_to_image"
            },
            data: {
                click_action: "FLUTTER_NOTIFICATION_CLICK",
                your_data: ...,
            },
            token: token
        }
    

    I have tested it using Flutter on Android and I would assume it works on native Android since they both probably use the same native SDK.

提交回复
热议问题