我目前在我的应用程序中有一个选项卡屏幕。我使用通知来通知用户应用程序状态的更改,在正常情况下,当用户单击通知时,它会返回到此选项卡屏幕。
以下是我用于此的代码:
String ns = Context.NOTIFICATION_SERVICE;
mNotificationManager = (NotificationManager) context.getSystemService(ns);
Intent notificationIntentRegState = new Intent();
ComponentName cn = new ComponentName(context, TabScreenActivity.class);
notificationIntentRegState.setComponent(cn);
contentIntentRegState = PendingIntent.getActivity(context, 0, notificationIntentRegState, 0);
notificationRegStateText = context.getString(R.string.app_name);
notificationRegState = new Notification(icon, notificationRegStateText, 0);
notificationRegState.setLatestEventInfo(context, notificationRegStateText, context.getString(R.string.notification_text, contentIntentRegState);
mNotificationManager.notify(3, notificationRegState);
但是在我的应用中,用户可以从TabScreen启动另一个活动,当此活动处于“活动”状态时,我希望通知将用户带到新活动而不是tabscreen活动。但是当点击通知时,它总是跳转到Tab屏幕。
是否有可能确保通知始终将用户引导到最近的活动?