我在我的應用程序中有一個活動。當我點擊一個選項,開始運行我的服務的前景,像這樣的通知:通知前臺服務PendingIntent android
PendingIntent pi = PendingIntent.getActivity(getApplicationContext(), 0,
new Intent(getApplicationContext(), Radio.class),
PendingIntent.FLAG_UPDATE_CURRENT);
Notification notification = new Notification();
notification.tickerText = "Connecting RadiO!.. Wait..";
notification.icon = R.drawable.ic_launcher;
notification.flags |= Notification.FLAG_ONGOING_EVENT;
notification.setLatestEventInfo(getApplicationContext(), "radiO!",
"Playing: " + songName, pi);
startForeground(1, notification);
然後,仍在運行我的活動,我點擊我的通知,我打開了它,但不關閉之前的活動。我不能有兩次同樣的活動。
http://developer.android.com/guide/topics/ui/notifiers/notifications.html#NotificationResponse – CommonsWare