华为推送的自定义推送与自定义字段
来源:互联网 发布:淘宝英雄联盟 编辑:程序博客网 时间:2024/06/08 18:46
自定义字段在通知栏被点击后获取,但是应用未启动的时候点击是获取不到自定义字段的。
自定义跳转的使用:在需要跳转的页面中添加以下属性
<activity .....><intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:host="com.packageName" android:path="/notify_detail" android:scheme="customscheme" /></intent-filter></activity>
然后在需要接受的页面中onCreat中和onNewIntent 中增加获取 Intent内容的处理。
华为自定义跳转的字段怎么填写呢?可以根据以下代码获取到intentUri,服务端可以拿到intentUri 的内容,替换msg里边的值,而服务端的json数据需要Encode编码一下才可以发送成功。
try { JSONObject object = new JSONObject(); object.put("context", "内容"); JSONArray messagejson1 = new JSONArray(); messagejson1.put(object.toString()); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("customscheme://" + "com.packageName/notify_detail?title= title&content=content")); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra("msg", messagejson1.toString()); String intentUri = intent.toUri(Intent.URI_INTENT_SCHEME);} catch (Exception e) {}
阅读全文
0 0
- 华为推送的自定义推送与自定义字段
- 华为推送 坑点 自定义intent
- 自定义登录后的推送
- 极光推送(JPush)通知与自定义消息的区别
- Android自定义消息推送
- iOS自定义推送音效
- ios 自定义推送声音
- 设置推送自定义声音
- 自定义推送显示按钮
- 极光自定义推送
- 自定义极光推送铃声
- jpush自定义推送声音
- Jpush 自定义推送声音
- Jpush 自定义推送声音
- 自定义消息推送
- 自定义推送消息
- 极光推送(二):自定义推送消息
- iOS 本地推送以及自定义推送声音
- Web上的用户登录功能安全
- File IO(NIO.2):什么是路径?
- 将博客搬至CSDN
- ABAP COLLECT语句用法深入解析
- Mysql数据库安装及配置
- 华为推送的自定义推送与自定义字段
- 运维之思科篇 -----3.HSRP(热备份路由协议),STP(生成树协议),PVST(增强版PST)
- QThread报错: Cannot create children for a parent that is
- PHP如何获取二维数组的长度详解
- SQL模糊查询%_^[]和Escape转义字符
- MySQL5.7 JSON类型使用介绍
- iOS 11 下适配UITableView 问题
- Secondary Namenode介绍
- LintCode刷题——数字三角形