Sek*_*har 7 android android-notifications firebase firebase-cloud-messaging
我正在开发一个应用程序,我已经集成了Firebase来处理通知.我只想知道如何获得从后端团队发送给我的主题名称.有三个主题,根据主题,我必须以不同的布局显示消息.我得到这样的头衔和身体:
if (remoteMessage.getData().size() > 0) {
//handle the data message here
try {
String title = remoteMessage.getNotification().getTitle();
String body = remoteMessage.getNotification().getBody();
Log.e("TITLE AND BODY", title + "\n" + body);
} catch (Exception e) {
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
在你的onMessageReceived(),只需使用RemoteMessage.getFrom():
获取此邮件的发件人.
这将是发件人ID或主题消息的主题.
如果收到的消息来自主题,则应返回主题名称的值.
| 归档时间: |
|
| 查看次数: |
1359 次 |
| 最近记录: |