Any intent that gets passed either when an activity is created or as a param to onNewIntent()
, lives as long as activity has not been destroyed. Well, even if the activity is launched from recent apps section after being destroyed but that's another issue.
My question is what should be the best practice in such cases to avoid duplicate processing due to old intent when activity is started/resumed from background or 'created' from recent apps section.
Say, am pulling getDataString()
for example for analytics which should ideally be tracked only when the app has actually started via a deeplink
. But it's very much available each time in the call-chain of onStart()
, inside the old intent. What is recommended?
- intent be set to null in
onStop()
? //seems most logical to me. pitfalls? - some local checks to ignore values?
- setting temporary field(s) in
onStop()
to identify if it's an old one?