小编Mal*_*bac的帖子

如何从RemoteMessage中找出通知通道ID

我在Android应用中注册了GoogleSamples后的通知频道https://github.com/googlesamples/android-NotificationChannels

但是,如何从RemoteMessage获取通知通道ID,因此我可以将其设置为NotificationBuilder.

public class FirebaseMessagingService extends com.google.firebase.messaging.FirebaseMessagingService {

@Override
public void onMessageReceived(RemoteMessage remoteMessage) 
{
//int id = remoteMessage.getNotificationChannel(); // -something like this I could not find
}
Run Code Online (Sandbox Code Playgroud)

我在RemoteMessage对象中找到了这个值

在此输入图像描述

value [3] ="notification_channel_system",因此我可以使用键值android_channel_id https://firebase.google.com/docs/cloud-messaging/http-server-ref将值设置为firebase推送通知,但我无法得到它被设备接收.

如何从PushNotification获取此ID并将其设置为通知构建器?

android firebase firebase-cloud-messaging android-8.0-oreo

13
推荐指数
2
解决办法
7402
查看次数