1

我正在我的应用程序中创建通知。

如何从以前的位置恢复我的应用程序(打开以前暂停的活动)

  NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);   

Intent intent = new Intent(getApplicationContext(), LoginActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, 0);    
Notification notification = new Notification(R.drawable.txlogo, "My App",  System.currentTimeMillis());
notification.setLatestEventInfo(getApplicationContext(), "My App", "simple notification", pendingIntent);
// and this
final int HELLO_ID = 1;
mNotificationManager.notify(HELLO_ID, notification);

但在上述情况下,当我点击通知时,它正在打开“LoginActivity”

我需要恢复上次显示的活动。

4

0 回答 0