I'm troubling with android pending intent when notification comes.
My application's call stack is like A>B>C. So, B never can be created without A, and C never can be created without B.
Let's call the activity D which will be lunched from notification. then when user get a notification of D, I want it to be belows.
case1 A(MainActivity) is top activity, call stack should be A > D
case2 B(SomeActivity) is top activity, call stack should be A > B > C
case3 C(anotherActivity) is top activity, call stack should be A > B > C > D case4 D is top activity, destroy old D and create new D. case5 app is terminated, call stack should be A > D.
It looks like simple. But hard to make it right. My codes are
Intent intent = D.getIntent(context, model.getTitle(), model.getId(), Intent.FLAG_ACTIVITY_NEW_TASK);
NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle();
PendingIntent mBoxPendingIntent = PendingIntent.getActivity(context, (int) model.getId(), intent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder b = new NotificationCompat.Builder(context)
.setStyle(bigTextStyle)
.setAutoCancel(true)
.setTicker(tickerText)
.setSmallIcon(smallIconRes)
.setContentTitle(model.getTitle())
.setContentText(model.getMessage())
.setContentIntent(mBoxPendingIntent)
.setWhen(when)
.setLights(0xFFBD5475, 500, 3000);
now the problem is case 5. If on touch notification when application terminated, D is launched stand alone without A; And I can't know wether the device will has Activity A or not when user touch the notification. What am i supposed to do?