【发布时间】:2019-04-13 19:15:41
【问题描述】:
我正在使用 firebase fcm 将通知推送到我的 android 应用程序。 我有两种情况:
- 当应用程序在前台时:我在 onMessageReceived 方法中收到消息
- 当应用程序在后台时:firebase 向我的设备推送通知,所以我想在通知中添加 LED 灯,并且我想振动设备。
我使用firebase云功能
request({
url: 'https://fcm.googleapis.com/fcm/send',
method: 'POST',
headers: {
'Content-Type' :' application/json',
'Authorization': 'key='+"" },
body: JSON.stringify({
data: {
title: 'Your app',
message: "",
body:""
},to : ""})
}, function(error, response, body) {
if (error) { console.error(error); }
});
【问题讨论】:
-
设置 LED 通知是设备特定的。您可以在手机的设置中进行这些设置。
-
在我的设备中,我有其他应用程序使用 LED 推送通知。但只有我的不显示光
标签: android firebase push-notification firebase-cloud-messaging