我有三个屏幕,例如登录,第二个和第三个。根据我的条件,我生成状态栏通知。如果用户单击通知,我想显示第三个屏幕。它工作正常。但是当我直接重新启动应用程序时,第三个屏幕来了。单击通知时,我想显示第三个屏幕。否则我的第一个屏幕应该是登录页面。
我可以使用以下代码显示通知
public void showNotification()
{
NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.ic_launcher, "A New Message!", System.currentTimeMillis());
Intent notificationIntent = new Intent(Preferences.this,PendingOffers.class);
PendingIntent pendingIntent = PendingIntent.getActivity(Preferences.this, 0, notificationIntent, 0);
notification.setLatestEventInfo(Preferences.this,"sample notification", "notificationMessage", pendingIntent);
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(0, notification);
};