使用Firebase FCM将LED灯设置为android通知

时间:2018-11-10 12:25:25

标签: android firebase push-notification firebase-cloud-messaging

我正在使用firebase fcm将通知推送到我的android应用。 我有两种情况:

  1. 当应用程序处于前台时:我通过onMessageReceived方法接收消息
  2. 当应用程序在后台运行时:Firebase将通知推送到我的设备,因此我想在通知中添加LED灯,并希望振动设备。

我使用Firebase云功能

Normal prinf funcation call from C
STDOUT, Got on STDOUT from C. - now: 2018-11-10 17:44:38
STDERR, Got in STDERR from C. - now: 2018-11-10 17:44:38
Normal prinf funcation call from C
STDOUT, Got on STDOUT from C. - now: 2018-11-10 17:44:39
STDERR, Got in STDERR from C. - now: 2018-11-10 17:44:39
Normal prinf funcation call from C
STDOUT, Got on STDOUT from C. - now: 2018-11-10 17:44:40
STDERR, Got in STDERR from C. - now: 2018-11-10 17:44:40
Normal prinf funcation call from C
STDOUT, Got on STDOUT from C. - now: 2018-11-10 17:44:41
STDERR, Got in STDERR from C. - now: 2018-11-10 17:44:41
Normal prinf funcation call from C
STDOUT, Got on STDOUT from C. - now: 2018-11-10 17:44:42
STDERR, Got in STDERR from C. - now: 2018-11-10 17:44:42

1 个答案:

答案 0 :(得分:0)

在FCM消息的数据部分中:

 ledColor: [240, 0, 45, 1], //show a blinking LED in ARGB color format