Android 集成个推推送后 默认处理推送的方式是打开应用,打开指定页面的话需要自己配置
其实很简单 只需要在 intentservice类里面的onReceiveMessageData处理透传消息的跳转即可
@Override public void onReceiveMessageData(Context context, GTTransmitMessage msg) { String appid = msg.getAppid(); String taskid = msg.getTaskId(); String messageid = msg.getMessageId(); byte[] payload = msg.getPayload(); String pkg = msg.getPkgName(); String cid = msg.getClientId(); // 第三方回执调用接口,actionid范围为90000-90999,可根据业务场景执行 boolean result = PushManager.getInstance().sendFeedbackMessage(context, taskid, messageid, 90001); Log.d(TAG, "call sendFeedbackMessage = " + (result ? "success" : "failed")); Log.d(TAG, "onReceiveMessageData -> " + "appid = " + appid + "\ntaskid = " + taskid + "\nmessageid = " + messageid + "\npkg = " + pkg + "\ncid = " + cid); if (payload == null) { Log.e(TAG, "receiver payload = null"); } else { String data = new String(payload); //处理透传消息 跳转至指定的activity if (data.startsWith("http")) { Log.d(TAG, "receiver payload = " + data); sendMessage(data, 0); Intent intent = new Intent(getBaseContext(), SearchContentActivity.class); Bundle bundle = new Bundle(); bundle.putString(BaseFragment.URL_ADDRESS, data); intent.putExtras(bundle); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); getApplication().startActivity(intent); } } }
个推的 开发者中心 推送通知 配置里面 在高级配置里面 加上透传内容