【发布时间】:2013-12-10 23:34:55
【问题描述】:
我的应用中有一个活动。当我单击一个选项时,开始运行我的服务前台并显示如下通知:
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);
然后,我仍然在运行我的活动,我点击了我的通知并打开了它,而没有关闭之前的活动。我不能有两次相同的活动。
【问题讨论】:
标签: android service notifications android-pendingintent