0
這是我的通知的代碼,點擊後默認打開mainactivity
,但是如何更改它?點擊時我想打開SecondActivity
。如何讓我的通知在點擊時啓動一項活動?
NotificationManager notificationManager = (NotificationManager) this
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification noti = new Notification.Builder(this)
.setAutoCancel(false)
.setContentIntent(
PendingIntent.getActivity(this, 0, getIntent(),
PendingIntent.FLAG_UPDATE_CURRENT))
.setContentTitle("X ADB").setContentText("client in running")
.setOngoing(true).setSmallIcon(R.drawable.ic_launcher)
.setTicker("ticker message")
.setWhen(System.currentTimeMillis()).build();
noti.flags |= Notification.FLAG_NO_CLEAR;
notificationManager.notify(111, noti);