您可以在发送参数时添加参数“image”在通知中显示任何图像。
使用带有图片的 FCM 是 assets 文件夹:
{"to":"[add your token]","notification":{"title":"[add title]","body":"[add your message]","image":"www/images/test_image.png"},"priority":"high"}
将 FCM 与可绘制文件夹中的图像一起使用:
{"to":"[add your token]","notification":{"title":"[add title]","body":"[add your message]","image":"ic_icon"},"priority":"high"}
将 FCM 与来自外部链接的图像一起使用:
{"to":"[add your token]","notification":{"title":"[add title]","body":"[add your message]","image":"http://www.test.com/test_img.png"},"priority":"high"}
将 GCM 与资产文件夹中的图像一起使用:
{"registration_ids": ["[please dont change]" ],"data": {"tickerText":"example test GCM","contentTitle":"content title GCM","message": "Enter your message","title":"GILAC","image":"www/images/test_img.png"}}
将 GCM 与可绘制文件夹中的图像一起使用:
{"registration_ids": ["[please dont change]" ],"data": {"tickerText":"example test GCM","contentTitle":"content title GCM","message": "Enter your message","title":"GILAC","image":"ic_icon"}}
将 GCM 与来自外部链接的图像一起使用:
{"registration_ids": ["[please dont change]" ],"data": {"tickerText":"example test GCM","contentTitle":"content title GCM","message": "Enter your message","title":"GILAC","image":"http://www.test.com/test_img.png"}}
注意:通知图标/图像必须是 png 图像。