我有一個正在運行的服務,它將啓動一個活動(MyActivity1
)。如果您通常啓動我的應用程序,則MyActivity2
是啓動的默認活動。完成意向後的結果
這是我收到
- 服務的行爲顯示了通知欄通知
- 的通知
- MyActivty1推出
- 他們完成這樣用戶點擊任何在本次活動我打電話
finish()
結束活動 - 他們被帶回到我的申請,並顯示
MyActivity2
。
在第5步中,我想讓他們返回到主屏幕而不是打開我的活動。這怎麼可能實現?
Context context = getApplicationContext();
Intent intent = new Intent(context, ExchangeConfigActivity.class);
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, intent, 0);
CharSequence from = getString(R.string.app_name);
CharSequence message = "Exchange Account - Setup Required";
Notification notif = new Notification(R.drawable.icon,"Message", System.currentTimeMillis());
notif.setLatestEventInfo(getApplicationContext(), from, message, contentIntent);
notif.flags = Notification.FLAG_AUTO_CANCEL;
nm.notify(id, notif);
「主屏幕」是指Android Home-Screen? –