android实现程序页面跳转中,个推实现指定页面跳转 for Android.txt

个推实现指定页面跳转 for Android.txt

package com.epoint.wssb.receiver;

import android.content.BroadcastReceiver;

import android.content.Context;

import android.content.Intent;

import android.os.Bundle;

import android.util.Log;

import com.epoint.frame.core.db.service.FrmDBService;

import com.epoint.jdsb.action.JDPushMsgAction;

import com.igexin.sdk.PushConsts;

import com.igexin.sdk.PushManager;

/**

* author andli

* create at 16/11/4 下午6:19

* 个推:消息广播接收器

**/

public class MSBPushReceiver extends BroadcastReceiver {

/**

* 应用未启动, 个推 service已经被唤醒,保存在该时间段内离线消息(此时 GetuiSdkDemoActivity.tLogView == null)

*/

public static StringBuilder payloadData = new StringBuilder();

@Override

public void onReceive(Context context, Intent intent) {

Bundle bundle = intent.getExtras();

Log.d("GetuiSdkDemo", "onReceive() action=" + bundle.getInt("action"));

switch (bundle.getInt(PushConsts.CMD_ACTION)) {

case PushConsts.GET_MSG_DATA:

// 获取透传数据

// String appid = bundle.getString("appid");

byte[] payload = bundle.getByteArray("payload");

String taskid = bundle.getString("taskid");

String messageid = bundle.getString("messageid");

// smartPush第三方回执调用接口,actionid范围为90000-90999,可根据业务场景执行

boolean result = PushManager.getInstance().sendFeedbackMessage(context, taskid, messageid, 90001);

System.out.println("第三方回执接口调用" + (result ? "成功" : "失败"));

if (payload != null) {

String data = new String(payload);

Log.d("GetuiSdkDemo", "receiver payload : " + data);

payloadData.append(data);

payloadData.append("\n");

// 处理透传信息

JDPushMsgAction.dealMsg(data);

}

break;

case PushConsts.GET_CLIENTID:

// 获取ClientID(CID)

String cid = bundle.getString("clientid");

FrmDBService.setConfigValue("pushclientid", cid);

break;

case PushConsts.THIRDPART_FEEDBACK:

break;

default:

break;

}

}

}

package com.epoint.jdsb.action;

import android.app.Notification;

import android.app.NotificationManager;

import android.app.PendingIntent;

import android.content.Context;

import android.content.Intent;

import android.graphics.BitmapFactory;

import android.support.v4.app.NotificationCompat;

import com.epoint.frame.core.app.AppUtil;

import com.epoint.jdsb.actys.JDBJDetailActivity;

import com.epoint.jdsb.actys.JDWebInfoDetailActivity;

import com.epoint.wssb.v6.jiangdu.R;

import com.google.gson.JsonObject;

import com.google.gson.JsonParser;

import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;

/**

* author zhouwn

* create at 2016/10/19,0019 上午 08:59.

* 消息到达处理

**/

public class JDPushMsgAction {

// 消息计数器

private static int MessageID = 10;

// 处理提醒消息

public static void dealMsg(String message) {

if (message != null) {

JsonObject jsonObject = new JsonParser().parse(message).getAsJsonObject();

String type = jsonObject.get("Type").getAsString();

Context con = AppUtil.getApplicationContext();

Intent intent = new Intent();

intent.setAction(System.currentTimeMillis() + "");

String Content = "";

if (type.equals("1")) {

// 打开信息详情

intent.setFlags(FLAG_ACTIVITY_NEW_TASK);

intent.setClass(con, JDWebInfoDetailActivity.class);

String InfoGuid = jsonObject.get("InfoGuid").getAsString();

intent.putExtra("InfoGuid", InfoGuid);

} else if (type.equals("2")) {

// 打开办件详情

intent.setFlags(FLAG_ACTIVITY_NEW_TASK);

intent.setClass(con, JDBJDetailActivity.class);

String ProjectGuid = jsonObject.get("ProjectGuid").getAsString();

intent.putExtra("ProjectGuid", ProjectGuid);

}

con.startActivity(intent);

}

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值