BUG: onResume() called TWICE in an Activity when tap on banner ad and then tap "back".

1,725 views
Skip to first unread message

Anton Cherkashyn

unread,
Oct 19, 2015, 4:05:09 PM10/19/15
to Google Mobile Ads SDK Developers
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:
  1. background and then foreground the app
  2. if you have a URL in a textview that takes you to a browser window and then you tap back
  3. if your app starts an activity for result and go back
  4. 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.

Andrew Brogdon (Mobile Ads SDK Team)

unread,
Oct 19, 2015, 5:02:36 PM10/19/15
to Google Mobile Ads SDK Developers
Thanks for posting such a detailed account of the problem you experienced. Every piece of information helps!

I've created an issue report based on your post, and have passed it on to our engineering team.

Thanks!

-Andrew

Anton Cherkashyn

unread,
Oct 19, 2015, 5:15:01 PM10/19/15
to Google Mobile Ads SDK Developers
Hi Andrew, thanks for your quick response.

Is there a URL to the issue report that you could share? Or some other way for me to keep track of the progress?

Andrew Brogdon (Mobile Ads SDK Team)

unread,
Oct 19, 2015, 5:28:37 PM10/19/15
to Google Mobile Ads SDK Developers
The reports are internal, but I'll be notified when the engineering team has addressed the issue and make note of it here.

-Andrew
Reply all
Reply to author
Forward
0 new messages