我正在使用Cordova製作移動應用程序,並試圖通過Google的Firebase發送推送通知。Firebase通知LED閃爍
我可以設置title
,body
,badge
, sound
等,但我不知道如何設置LED閃爍時收到通知。
我試過使用localNotification
,但它需要應用程序始終運行。
你們有沒有關於如何解決這個問題的想法?
我正在使用Cordova製作移動應用程序,並試圖通過Google的Firebase發送推送通知。Firebase通知LED閃爍
我可以設置title
,body
,badge
, sound
等,但我不知道如何設置LED閃爍時收到通知。
我試過使用localNotification
,但它需要應用程序始終運行。
你們有沒有關於如何解決這個問題的想法?
也許有點晚,但對其他讀者:
在NotificationCompat.Builder添加此
.setLights(int argb, int onMs, int offMs)
文檔:
設置您想對LED的ARGB值該設備眨眼, 以及率。
來源:https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html
這工作對我們來說,在服務器上使用node-gcm:
var gcm = require('node-gcm');
var push = new gcm.Message({
data: {
title: 'Your app',
message: message,
ledColor: [215, 138, 138, 1], //show a blinking LED with given color in ARGB format
},
});
gcmSender.send(push, [token], function(err, res) {
console.log(res);
});