I have several actions in my application. Please consider the following case ...
Action A calls Acitivy BB calls C. When the user presses the C key, generates a notification and proceeds to B. Now press again to display A, and the back key will appear again and a notification will appear ... Now that the user clicks the notification icon, C activity is loading .... Until this part is correct .... Now the user clicks back, I start operation A using my code when C was loaded from Notification.
Another case, Activity A calls Acitivy B. B calls C. When the user presses the C key, generates a notification and proceeds to B. Now the user presses HOME KEY. Then after some time selects the notification icon, it displays the action C. Now the user presses the Back Key, by default it displays Activity B (which I want) .... But my code (like C, loaded from the notification) ... im display activity A (n the user presses back, then activity B is displayed).
I want to find out the Activity Count of my own application so that I can avoid executing my code in order to run Activity A (if it's not 1).
So far I have done this using the following code
ActivityManager actM = (ActivityManager) getSystemService(ACTIVITY_SERVICE); List<ActivityManager.RunningTaskInfo> listm = actM.getRunningTasks(1); int iNumActivity = listm.get(0).numActivities;
But using this code requires the use of GET_TASKS permission ... I don’t like this because I do not track any other data about application data / activity.
How to fix it? Is there any other way to achieve this?
EDIT How do I know the amount of activity of my own application?
source share