广播
public class MyReceive extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals(JPushInterface.ACTION_NOTIFICATION_OPENED)){
Intent intent1 = new Intent(context, OtherActivity.class);
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent1);
}
System.out.println("我接收到了推送的信息");
}
}
MyApplication
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
JPushInterface.setDebugMode(true);
JPushInterface.init(this);
}
}