app 点击推送 怎么进入指定页面

如题所述

功能说明
JPush SDK 收到推送,通过广播的方式,转发给开发者App,这样开发者就可以灵活地进行处理。
这个动作不是必须的。用户有需要才定义 Receiver 类来处理 SDK过来的广播。
如果不做这个动作,即不写自定义 Receiver,也不在 AndroidManifest.xml 里配置这个 Receiver,则默认的行为是:
接收到推送的自定义消息,则没有被处理
可以正常收到通知,用户点击打开应用主界面
接受广播
如果全部类型的广播都接收,则需要在 AndroidManifest.xml 里添加如下的配置信息:

<receiver
android:name="Your Receiver"
android:enabled="true">
<intent-filter>
<action android:name="cn.jpush.android.intent.REGISTRATION" />
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />

<category android:name="You package Name" />
</intent-filter>
</receiver>

每个 Receiver action 详细解释如下。
Action - cn.jpush.android.intent.REGISTRATION
SDK 向 JPush Server 注册所得到的注册 ID 。
一般来说,可不处理此广播信息。
要深入地集成极光推送,开发者想要自己保存App用户与JPush 用户关系时,则接受此广播,取得 Registration ID 并保存与App uid 的关系到开发者自己的应用服务器上。
使用极光推送提供的别名与标签功能,是更加简单轻便的绑定App用户与JPush用户的方式,请参考文档:别名与标签使用教程。
Intent 参数
JPushInterface.EXTRA_REGISTRATION_ID
SDK 向 JPush Server 注册所得到的注册 全局唯一的 ID ,可以通过此 ID 向对应的客户端发送消息和通知。

Bundle bundle = intent.getExtras();
String title = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);

Action - cn.jpush.android.intent.MESSAGE_RECEIVED
收到了自定义消息 Push 。
SDK 对自定义消息,只是传递,不会有任何界面上的展示。
如果开发者想推送自定义消息 Push,则需要在 AndroidManifest.xml 里配置此 Receiver action,并且在自己写的 BroadcastReceiver 里接收处理。
Intent 参数
JPushInterface.EXTRA_TITLE
保存服务器推送下来的消息的标题。
对应 API 消息内容的 title 字段。
对应 Portal 推送消息界面上的“标题”字段(可选).

Bundle bundle = intent.getExtras();
String title = bundle.getString(JPushInterface.EXTRA_TITLE);

JPushInterface.EXTRA_MESSAGE
保存服务器推送下来的消息内容。
对应 API 消息内容的 message 字段。
对应 Portal 推送消息界面上的"消息内容”字段。

Bundle bundle = intent.getExtras();
String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);

JPushInterface.EXTRA_EXTRA
保存服务器推送下来的附加字段。这是个 JSON 字符串。
对应 API 消息内容的 extras 字段。
对应 Portal 推送消息界面上的“自定义内容”。

Bundle bundle = intent.getExtras();
String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);

JPushInterface.EXTRA_CONTENT_TYPE
保存服务器推送下来的内容类型。
对应 API 消息内容的 content_type 字段。

Bundle bundle = intent.getExtras();
String type = bundle.getString(JPushInterface.EXTRA_CONTENT_TYPE);

JPushInterface.EXTRA_RICHPUSH_FILE_PATH
SDK 1.4.0 以上版本支持。
富媒体通消息推送下载后的文件路径和文件名。
温馨提示:答案为网友推荐,仅供参考

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网