1
默認通知點擊行爲正在執行活動,但我想顯示敬酒或調用方法。我怎麼做?如何讓我的通知執行操作onclick?
//**cleareble notification**//
NotificationManager notificationManager = (NotificationManager) this
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification noti = new NotificationCompat.Builder(this)
.setAutoCancel(true)
.setContentIntent(
PendingIntent.getActivity(this, 0, getIntent(),
PendingIntent.FLAG_UPDATE_CURRENT))
.setContentTitle("HELLO world")
.setContentText("PLEASE CHECK WE HAVE UPDATED NEWS")
.setDefaults(Notification.DEFAULT_ALL)
.setSmallIcon(R.drawable.ic_launcher)
.setTicker("ticker message")
.setWhen(System.currentTimeMillis()).build();
//noti.flags |= Notification.FLAG_NO_CLEAR;
notificationManager.notify(0, noti);
您需要的活動,以顯示你的吐司 – 2016-12-31 18:00:21
我該如何推出一些其他活動,而不是主? –
[Here](http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/)是Firebase上的一個很好的教程。 –