public class PushMessageReceiver extends JPushMessageReceiver { /** * 点击通知回调 * * @param context * @param message 通知消息 */ @Override public void onNotifyMessageOpened(Context context, NotificationMessage message) { Log.e(TAG, "[onNotifyMessageOpened]:" + message); //自定义打开到通知栏点击后的容器页 Intent intent = parseNotificationMessage(IntentUtils.getIntent(context, NotificationTransferActivity.class, null, true), message); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); ActivityUtils.startActivity(intent); } /** * 解析极光通知消息:NotificationMessage */ public static Intent parseNotificationMessage(@NonNull Intent intent, NotificationMessage message) { //这只是一个例子,暂时把跳转的目标页设为 "通知信息展示" intent.putExtra("pageName", "通知信息展示"); //通知标题 intent.putExtra("title", message.notificationTitle); //通知内容 intent.putExtra("content", message.notificationContent); //通知附带拓展内容 intent.putExtra("extraMsg", message.notificationExtras); //通知附带键值对 intent.putExtra("keyValue", message.notificationExtras); return intent; } }
2.通过DeepL