我想在Android中使用Firebase云函数在通知有效负载中显示照片。我想实现类似于screenshot.
中所示的内容
我的cloud函数payload代码在这里:
message = {
notification: {
title: username,
body: content,
image: profileImageUrl, // I'm passing image url as image parameter
},
token: deviceToken,
};
return admin
.messaging()
.send(message)
.then(async (response) => {
return console.log(
"Successfully sent notification:",
deviceToken
);
})
.catch(async (error) => {
return console.log("Error sending notification:", error);
});
})
.catch(async (error) => {
return console.log("Error:", error);
});
字符串
下面的代码不工作
2条答案
按热度按时间r6vfmomb1#
不如这样:
字符串
From:https://firebase.google.com/docs/cloud-messaging/android/send-image
e5nszbig2#
“notification”:{
字符串
}