android点击通知栏跳转,Android 各平台推送通知栏点击处理方案
小米
当收到推送通知并点击时会回调
io.rong.push.platform.mi.MiMessageReceiver#onNotificationMessageClicked 方法
在以上方法中会发送广播并触发继承 PushMessageReceiver 类的 onNotificationMessageClicked 方法。
在此方法中的参数 PushNotificationMessage 中可以获得以下信息String pushId; //对应推送消息的唯一Id,如果是消息转push,则为消息的uid
RongPushClient.ConversationType conversationType; //会话类型
String objectName; // 消息类型:RC:Txt RC:Img ...
String senderId; // 发送者ID
String senderName; // 发送者名称
Uri senderPortrait; //发送者头像地址
String targetId; // 目标Id。ex: 群里的某人发了一条消息,则targetId为群Id,senderId为群里的这个用户的Id。
String targetUserName; //目标名字。
String toId; //该推送的目标用户。
String pushTitle; //推送消息的标题
String pushContent; //推送消息内容
String pushData; // 客户端发送push消息时的附加字段
String isFromPush; //是push消息时为true, 后台消息时为false
PushSourceType sourceType; //推送来源。
当重写 onNotificationMessageClicked 返回 false 时, SDk 会以以下 action 进行跳转 Activityrong://【你的 ApllicationId】/conversation/private?targetId=【目标 targetId】&title=【推送标题】&isFromPush=true
当在 AndroidManifest.xml 中,您的会话界面 Activity 中加入 Intent-filter 进行拦截即可跳转android:name="您的会话界面 Activity"
>
android:host="你的 ApllicationId"
android:path="/conversation/"
android:scheme="rong" />
华为
当收到推送通知并点击时默认是会以以下 uri 的打开 Activity
rong://【你的 ApllicationId】/conversationlist?isFromPush=true
您需要当在 AndroidManifest.xml 中,您的会话列表界面 Activity 中加入 Intent-filter 进行拦截即可跳转android:name="您的会话界面 Activity"
>
android:host="你的 ApllicationId"
android:path="/conversationlist"
android:scheme="rong" />
在 Intent 中 携带 extrasoptions:{"rc":"{"conversationType":"1","sourceType":"0","fromUserId":"NyKWhpEUl","objectName":"RC:TxtMsg","id":"BF4A-V7G3-85S5-0LG6","tId":"vu0JWCcQY","targetId":"NyKWhpEUl"}"}
可以通过以下方式获取推送相关信息:JSONObject jsonObject = new JSONObject(options);
JSONObject rc = new JSONObject(jsonObject.getString("rc"));
Conversation.ConversationType conversationType =
Conversation.ConversationType.setValue(rc.getInt ("conversationType")); // 会话类型
String targetId = rc.getString("NyKWhpEUl"); // 目标 targetId
然后可以通过以下代码跳转到对应的会话界面中RongIM.getInstance().startConversation(context, conversationType, targetId, "");
魅族
目前魅族点击通知栏时推回调
io.rong.push.platform.meizu.MeiZuReceiver#onNotificationClicked 方法
在以上方法中会发送广播并触发继承 PushMessageReceiver 类的 onNotificationMessageClicked 方法。
在此方法中的参数 PushNotificationMessage 中可以获得以下信息String pushId; //对应推送消息的唯一Id,如果是消息转push,则为消息的uid
RongPushClient.ConversationType conversationType; //会话类型
String objectName; // 消息类型:RC:Txt RC:Img ...
String senderId; // 发送者ID
String senderName; // 发送者名称
Uri senderPortrait; //发送者头像地址
String targetId; // 目标Id。ex: 群里的某人发了一条消息,则targetId为群Id,senderId为群里的这个用户的Id。
String targetUserName; //目标名字。
String toId; //该推送的目标用户。
String pushTitle; //推送消息的标题
String pushContent; //推送消息内容
String pushData; // 客户端发送push消息时的附加字段
String isFromPush; //是push消息时为true, 后台消息时为false
PushSourceType sourceType; //推送来源。
当重写 onNotificationMessageClicked 返回 false 时, SDk 会以以下 action 进行跳转 Activityrong://【你的 ApllicationId】/conversation/private?targetId=【目标 targetId】&title=【推送标题】&isFromPush=true
当在 AndroidManifest.xml 中,您的会话界面 Activity 中加入 Intent-filter 进行拦截即可跳转android:name="您的会话界面 Activity"
>
android:host="你的 ApllicationId"
android:path="/conversation/"
android:scheme="rong" />
同时点击通知栏时还会跳转到您应用桌面入口所对应的 Activity,并在 Intent 通过 getIntent().getExtras() 方式获取的 Bundle 中附带以下内容。sdkVersion: SDK 版本(如:2.10.2)
isShowPushContent:是否显示推送内容(如:1)
rc:推送内容(如:{"conversationType":"1","fromUserId":"发送者用户id","id":"XXXX-XXXX-XXXX-XXXX","objectName":"RC:TxtMsg","sourceType":"0","tId":"接受者用户id"})
timestamp:时间戳
appId:AppKey
channelType:会话类型整形类型(如:1)
receiverUserId:接收消息用户 id
clientOs:操作系统
packageName:包名
content:消息内容
objectName:消息类型名(如:RC:TxtMsg)
fromUserName:用户名称
注意:所以当您在 onNotificationMessageClicked 方法中返回 false,会先跳转到桌面入口对应的 Activity ,然后跳转到注册接受 rong://【你的 ApllicationId】/conversation/ 所对应 Activity。
oppo
点击通知栏时会跳转到您应用桌面入口所对应的 Activity,并在 Intent 通过 getIntent().getExtras() 方式获取的 Bundle 中附带以下内容。sdkVersion: SDK 版本(如:2.10.2)
isShowPushContent:是否显示推送内容(如:1)
rc:推送内容(如:{"conversationType":"1","fromUserId":"发送者用户id","id":"XXXX-XXXX-XXXX-XXXX","objectName":"RC:TxtMsg","sourceType":"0","tId":"接受者用户id"})
timestamp:时间戳
appId:AppKey
channelType:会话类型整形类型(如:1)
receiverUserId:接收消息用户 id
clientOs:操作系统
packageName:包名
content:消息内容
objectName:消息类型名(如:RC:TxtMsg)
fromUserName:用户名称
然后可以通过以下代码跳转到对应的会话界面中Bundle extras = getIntent().getExtras();
JSONObject rc = new JSONObject(extras.getString("rc"));
Conversation.ConversationType conversationType =
Conversation.ConversationType.setValue(rc.getInt("conversationType"));
String targetId = rc.getString("fromUserId");
RongIM.getInstance().startConversation(context, conversationType, targetId, "");
vivo
点击通知栏时会跳转到您应用桌面入口所对应的 Activity,目前 vivo 没有将其他参数传入 Intent 中,即没法跳转到对应用户的会话界面中,我们将在以后的版本中加入会话相关信息。
FCM
当收到推送时会回调
io.rong.push.platform.google.RongFirebaseMessagingService#onMessageReceived 方法
在以上方法中会发送广播并触发继承 PushMessageReceiver 类的 onNotificationMessageArrived 方法。
当 onNotificationMessageArrived 回调返回 false 时,会产一条融云生成的通知栏消息。
当点击该通知时会触发 发继承 PushMessageReceiver 类的 onNotificationMessageClicked 方法。
在此方法中的参数 PushNotificationMessage 中可以获得以下信息String pushId; //对应推送消息的唯一Id,如果是消息转push,则为消息的uid
RongPushClient.ConversationType conversationType; //会话类型
String objectName; // 消息类型:RC:Txt RC:Img ...
String senderId; // 发送者ID
String senderName; // 发送者名称
Uri senderPortrait; //发送者头像地址
String targetId; // 目标Id。ex: 群里的某人发了一条消息,则targetId为群Id,senderId为群里的这个用户的Id。
String targetUserName; //目标名字。
String toId; //该推送的目标用户。
String pushTitle; //推送消息的标题
String pushContent; //推送消息内容
String pushData; // 客户端发送push消息时的附加字段
String isFromPush; //是push消息时为true, 后台消息时为false
PushSourceType sourceType; //推送来源。
当重写 onNotificationMessageClicked 返回 false 时, SDk 会以以下 action 进行跳转 Activityrong://【你的 ApllicationId】/conversation/private?targetId=【目标 targetId】&title=【推送标题】&isFromPush=true
当在 AndroidManifest.xml 中,您的会话界面 Activity 中加入 Intent-filter 进行拦截即可跳转android:name="您的会话界面 Activity"
>
android:host="你的 ApllicationId"
android:path="/conversation/"
android:scheme="rong" />
android点击通知栏跳转,Android 各平台推送通知栏点击处理方案相关推荐
- android 华为推送通知中心,华为推送通知栏消息功能及 intent 说明文档
华为推送分为透传推送和通知栏推送两种方式. 两种方式的区别如下: 透传推送:华为推送服务会将原始 json 数据发给目标客户端,客户端内嵌的融云 SDK 接受到该 json 数据后,会进行解析并在通知 ...
- 如何通过A/B测试提升Push推送消息点击率?
618电商节火热进行中,某电商App准备向用户推送一条全局活动消息,运营准备了两个推送文案: 文案A:年中囤货我们更懂你,没有大优惠怎敢惊动你:美妆个户,户外运动,医疗健康,一站式备齐,点击>& ...
- 点击图片跳转android,android 跳转相册选择图片并返回展示
1.点击事件跳转 private void selectImage() { Intent intent = new Intent(); intent.setType("image/*&quo ...
- android底部导航进行跳转,Android实现底部导航菜单的跳转--BottomNavigationView
效果: 项目结构: 需要用到design依赖: 现在是:implementation 'com.android.support:design:28.0.0' 代码: activity_main.xml ...
- Android开发笔记(一百零四)消息推送SDK
推送的集成 常用概念 推送:从服务器把消息实时发到客户端app上,这就是推送,推送可用于发送系统通知.发送推荐信息.发送聊天消息等等. 别名:用于给移动设备取个好记的名字,比如电脑有计算机名,可以把别 ...
- Android开发笔记(五十二)通知推送Notification
PendingIntent 准备工作复习一下PendingIntent,前面的博文< Android开发笔记(五十)定时器AlarmManager>已经提到了它.PendingIntent ...
- 魅族现在是Android几了,终于等到你,魅族今日推送 Android 10 内测版 Flyme
一个月之前,Flyme 宣布将会向魅族旗下 10 款机型适配 Android 10 的系统更新,预计将会在 7 月 21 日陆续推送内测版系统的更新. 要知道,近几年魅族发布的手机基本上都没有进行 A ...
- Android O系统(android8.0)手机极光推送失败
这个问题... 是有点坑.... 项目中极光推送集成的比较早,所以就没在意,今天有用户反应收不到推送,哈哈,赶紧去官网看看,果然 首先替换了所有的jar文件进行升级 其次,推送收到后需要自己弹框显示, ...
- Android 高仿微信实时聊天 基于百度云推送
一直在仿微信界面,今天终于有幸利用百度云推送仿一仿微信聊天了~~~ 首先特别感谢:weidi1989分享的Android之基于百度云推送IM ,大家可以直接下载:省了很多事哈,本例中也使用了weidi ...
最新文章
- [kuangbin带你飞]专题五 并查集 E - 食物链 (带权并查集)
- zend studio报错
- 阿里云对象存储OSS之通过URL形式进行图片处理
- C++头文件引入的一种小问题
- 高可用-软件heartbeat的入门介绍
- java运行时读取注解_Java自定义注解和运行时靠反射获取注解
- Nodejs最好的ORM - TypeORM
- Jsoncpp 使用方法大全
- android适配各种分辨率的问题
- 图解WinHex使用入门
- 最受欢迎的9个前端UI框架
- GPC规范--安全域基础概念
- 【Python】将多个jpg合并成一个pdf
- kubectl源码分析之config delete-context
- Oracle- imp/impdp导入dmp文件
- 数据分析(二)特征值和特征向量、奇异值、傅里叶变换
- 玉米社:视频营销推广 标题描述优化技巧
- 北京羽毛球场馆全攻略
- javascript实现的淘宝五星评价(版本2)
- win10关机后自动重启_win10电脑自动关机设置方法