ENVIRONMENT:
* play services version targeted in build.gradle: 8.1.0
Reproducibility:
* Doesn't reproduce on: Nexus 5(Android 6.0), Samsung Galaxy S4(Android 5.1)
* 100% reproducible on: Genymotion emulators(Android 4.4.4, 5.1.0), Samsung Galaxy S3(Android 4.4.4)
STR:* Set up an activity with AdMob ad or DFP ad in it.
* Override onResume() and onStop() methods in this activity and set debug breakpoints on them.
* Launch the application in the debug mode, open the activity, see an ad displayed.
* Tap on the ad. A browser window is opened, takes you to an ad landing page.
* Tap "back", and keep track of the breakpoints being triggered.
Actual result:
* onResume() -> onPause() -> onResume() are being called in sequence.
Expected result:
* onResume() should be called just once.
Why is this an issue?
* Because I report page views to Google Analytics in onResume() method of the activity and since onResume() is called twice, I end up with duplicate page views.
* Because this issue doesn't happen if you:
- background and then foreground the app
- if you have a URL in a textview that takes you to a browser window and then you tap back
- if your app starts an activity for result and go back
- if your app fires an intent that starts up another application and then you tap "back".
Only tapping on AdMob/DFP ad causes this issue, this is not consistent with Android activity life cycle
. Please let me know if there's any workaround.