0
通知をクリックしたときにアクティビティを開始するにはどうすればよいですか?私は意図を挿入しようとしているが、代わりにNotificationCompat.Builder
を使用し、Notification.Builder
を使用しないでくださいanything-通知でアクティビティを開始する
// **non cleareble notification**//
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("HELLO world")
.setContentText("PLEASE CHECK WE HAVE UPDATED NEWS")
.setDefaults(Notification.DEFAULT_ALL).setOngoing(true)
.setSmallIcon(R.drawable.ic_launcher)
.setTicker("ticker message")
.setWhen(System.currentTimeMillis()).build();
noti.flags |= Notification.FLAG_NO_CLEAR;
notificationManager.notify(0, noti);
Intent intent = new Intent(this, NotificationAction.class);
は、すべてのAPIレベルはい、それが必要 –
にこの作業を行います。 – GVillani82