Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Analytics Coffee Break: On Monday, January 30 at 10am PT, the NOAM User Group led by Jennifer Dungan and Jeff Bloomer will be joining us to answer your Analytics related questions. To register and for more information, follow the link to the right.

How to tag to trigger on previous page when visitor visit back from current page in Android app?


Level 1


I would like to check with you about any performance issue in adobe analytics tracking in Android app when Tag need to trigger on previous page when visitor visit back from current page.


In adobe analytics tracking in Android app, currently we are using onCreate/onCreateView function to trackState for page tracking.


Is my understanding is correct about page tracking in onCreate/onCreateView of previous page can't trigger the tag again in Android app when visitor visit back from current page?


To trigger tag on previous page, do we need to write trackState in onResume function?


If we write trackState in onResume function, is there any impact in Android app's performance?


Any recommendation for how to implement this?


Thank you.

2 Replies


Community Advisor

OnResume is called when the app is sent to the background and then resumed... it doesn't directly correspond to your onCreate or onCreateView. OnResume is tied more closely with the onPause function.


You should absolutely be using onPause to stop analytics when the app is sent to the background, and onResume when the app is brought back to the forefront... Assuming you have LifeCycle metrics enabled, onPause when the app is sent to the background will prevent inflated "crashEvents" from firing (if analytics is not paused, and the app is sent to the background, then the user force closes the app by swiping it off, a Crash will be reported on the next launch - this is not what you want). Using the onPause to pause Lifecycle metrics, then restarting LifeCycle metrics using onResume is the recommended implementation. You should be able to let you developers know what action to perform on onResume (including restarting lifecycle metrics, and you could even take a timestamp of when onPause was fired and send on trackState IF the time elapsed is more than 30 mins - or whatever your session timeout is set to)


As for returning to the previous page, I am not entirely sure all the Android actions that are available (I am not a mobile developer), but in order to re-display the page, the developers must be leveraging some action, they should be able to trigger analytics with that.


Level 6

Actually, Adobe's documentation is referring to onResume for the lifecycle tracking and hence I use that for trackState as well,

Referring to the Activity lifecycle at, onResume is the better place than onCreate, as onCreate will only trigger once when the activity is created after the app process had been killed.

I didn't test the following to prove it.

So not only the "previous page", even when the user navigates to some other different activities in the Android app and navigate back to this very original activity via normal menu navigation, there will no more trackState from onCreate as the app process had never be killed and hence no onCreate invoked.