firebase消息:图像不显示通过负载在android



firebase messaging image在android中无法通过payload显示,但在iOS中可以正常工作

I/FirebaseMessaging( 1559): Starting download of: https://www.kindpng.com/picc/m/252-2524695_dummy-profile-image-jpg-hd-png-download.png
W/FirebaseMessaging( 1559): Failed to download image: java.io.FileNotFoundException: https://www.kindpng.com/picc/m/252-2524695_dummy-profile-image-jpg-hd-png-download.png

这是我的有效载荷

{
"message": {
"token": "fh748hf......",
"notification": {
"body": "This is an FCM notification message!",
"title": "FCM Message"
},
"data": {
"body": "This is an FCM notification message!",
"title": "FCM Message"
},
"android": {
"notification": {
"image": "https://www.kindpng.com/picc/m/252-2524695_dummy-profile-image-jpg-hd-png-download.png"
}
},
"apns": {
"payload": {
"aps": {
"mutable-content": 1
}
},
"fcm_options": {
"image": "https://www.kindpng.com/picc/m/252-2524695_dummy-profile-image-jpg-hd-png-download.png"
}
}
}
}

下面的命令返回403 Forbidden.

curl -v https://www.kindpng.com/picc/m/252-2524695_dummy-profile-image-jpg-hd-png-download.png --output image.png

添加用户代理后,下载成功。

curl -v --user-agent "foobar"  https://www.kindpng.com/picc/m/252-2524695_dummy-profile-image-jpg-hd-png-download.png --output image.png

值得一试

最新更新