通知をクリックするとタイマーアプリを開きたい。私はすでに以下のコードを試していますが、新しいアクティビティを開始しています。私は既に実行している活動を開始したい。通知アクションで実行中のアクティビティを開くにはどうすればよいですか?
Intent intent = new Intent(timer.this, timer.class);
PendingIntent pIntent = PendingIntent.getActivity(timer.this, 0, intent, 0);
notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
notification = new Notification.Builder(timer.this)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentIntent(pIntent)
.setContentTitle(clickedinterval)
.setContentText("Pause" + " Time remaining: " + minutesPauseCountDown + ":" + secondsPauseCountDown)
.build();
notification.flags = Notification.FLAG_ONGOING_EVENT | Notification.DEFAULT_LIGHTS;
notificationManager.notify(0, notification);
を試すことができますか? –