【问题标题】:Firebase notification LED blinkFirebase 通知 LED 闪烁
【发布时间】:2016-12-12 00:04:03
【问题描述】:

我正在使用 Cordova 制作移动应用程序,并尝试通过 google's Firebase. 发送推送通知

我可以设置titlebodybadgesound 等,但我不知道如何设置 LED 在收到通知时闪烁。

我尝试使用localNotification,但它要求应用程序始终处于运行状态。

你们对如何解决这个问题有任何想法吗?

【问题讨论】:

    标签: android cordova firebase push-notification led


    【解决方案1】:

    可能有点晚了,但对于其他读者来说:

    在 NotificationCompat.Builder 中添加这个

    .setLights(int argb, int onMs, int offMs)
    

    文档:

    设置您希望设备上的 LED 闪烁的 argb 值, 以及费率。

    来源:https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Builder.html

    【讨论】:

      【解决方案2】:

      这对我们有用,在服务器上使用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);
      });
      

      【讨论】:

        猜你喜欢
        • 2021-08-28
        • 2015-12-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多