Interstitial close shows previous screen when activity is finished

1,821 views
Skip to first unread message

John

unread,
Jan 11, 2018, 4:34:16 AM1/11/18
to Google Mobile Ads SDK Developers
Hi,

If have received an Admob policy violation email for an interstitial of my app (interstitial that appears suddenly). The problem is not that the interstitial appears suddenly, the problem is when user closes the ad.
After a lot of test I have noticed that the problem seems to be because after the user closes the interstitial, the previous screen is shown for a few milliseconds, before the next activity starts, but this just happens when I “finish()” the previous activity.
I have more interstitial in the same app and it doesn’t happen.

My code:
public void loadInterstitialAndShowWhenLoaded() {
        interstitial
= new InterstitialAd(this);
        interstitial
.setAdUnitId(getString(R.string.admob_interstitial_id));
       
AdRequest adRequest = new AdRequest.Builder().build();
        interstitial
.loadAd(adRequest);


        interstitial
.setAdListener(new AdListener() {
           
@Override
           
public void onAdClosed() {
               
super.onAdClosed();
                nextActivity
();
           
}


           
@Override
           
public void onAdFailedToLoad(int errorCode) {
               
super.onAdFailedToLoad(errorCode);
                nextActivity
();
           
}


           
@Override
           
public void onAdLoaded() {
               
super.onAdLoaded();
                interstitial
.show();
           
}
       
});
   
}


   
private void nextActivity() {
        startActivity
(...);
        finish
();
   
}



App Info:
Google Play Services = 11.6.0
Android target SKD version = 26

Android device info:
Nexus 5X
Android 8.1.0
Google Play Services: 11.9.51

Thanks,

Deepika Uragayala- MobileAds SDK team

unread,
Jan 11, 2018, 2:56:02 PM1/11/18
to Google Mobile Ads SDK Developers
Hi John,

Thanks for reaching out to us. We wouldn't be able to comment unless we are able to reproduce this locally. The nextActivity() looks to be the issue here but I wouldn't be able to debug unless you can share a sample app that reliably reproduces this issue. Please share the reliable steps to reproduce the issue and we will debug this further.

You can share your Sample app by using "Reply Privately to Author" option.

Regards,
Deepika Uragayala
Mobile Ads SDK Team
Message has been deleted

John

unread,
Jan 12, 2018, 3:38:29 AM1/12/18
to Google Mobile Ads SDK Developers
Hi Deepika,

Thanks for your reply.

I have reproduced the issue modifying your interstitial example, I have attached a zip with the app code so you can test it.
The forums are throwing error when trying to send the message with attached file, so we have uploaded the example code here:

If you run the code and you press the “retry” button the current activity will be finish() and a transition to a new Activity will be done with an interstitial in between.
With that code you will see that after you close the Interstitial you can see the “first” activity during a moment before the second one is shown.

If you comment the line 150 where the “finish()” statement is and you run the app, you will see that the issue doesn’t happen, and the transition it’s correct.

We have noticed that with this simple example the time the previous activity is shown is very short, in our apps that we have much more complicated layouts the previous activity is shown more time.

Hope this will help you to understand our issue.

Thank you.
Best Regards.

Deepika Uragayala- MobileAds SDK team

unread,
Jan 12, 2018, 3:07:08 PM1/12/18
to Google Mobile Ads SDK Developers
Hi John,

Thank you for the sample app as this makes us debugging the issue much quicker. I would not be able to comment on the policy itself but Interstitials are not meant to be shown between Activity transitions. This is only a policy related issue and you would best be advised with our AdMob Product Support team. You can also take a look at our implementation guidance articles, which covers most of the use cases. 
Regards,
Deepika Uragayala 
Mobile Ads SDK Team

John

unread,
Jan 15, 2018, 2:45:45 AM1/15/18
to Google Mobile Ads SDK Developers
Hi Deepika,

Thank you for your answer.
As we can see in the documentation, interstitials appear between pages in a natural way (page transitions).
Here you can see an example of the admob documentation:

And here an image where you can see the transition:


In the transitions of the app (between activities), all works correctly, the problem is if we finish() the Activity after the next startActivity, as you can see in the code sample we sent you in the previous message, there is a problem and a delay, and that was the problem with the policies (the delay).
We have fixed internally forcing the finish() to be executed after a delay, but we though this was interesting for the admob team or android team, so you could check it.

Looking forward to your reply.

Thank you,

Joshua Lagonera (Mobile Ads SDK Team)

unread,
Jan 15, 2018, 5:57:04 AM1/15/18
to Google Mobile Ads SDK Developers
Hi John,

Thank you for providing a write-up of the issue. 

Looking at your code snippet on your initial post, I noticed that you are trying to show an Interstitial Ad right after it loads, as shown below:

public void onAdLoaded() {
 
super.onAdLoaded();
  interstitial
.show();
}

Kindly note that Interstitial Ads are meant to be shown during natural pauses in your application

As for the sample project you provided on your earlier post, I was not able to see anything out of the ordinary with it and this does not seem to be an SDK specific issue.

However, as mentioned by my colleague, we are not able to comment regarding permissible implementations, so it would be best for you to confirm this to our Product Support Team as they are the more applicable team to shed some light on this subject.

Regards,
Joshua Lagonera
Mobile Ads SDK Team

mehran aaptrick

unread,
Jul 9, 2020, 3:17:31 AM7/9/20
to Google Mobile Ads SDK Developers
Hi John, I am facing the same problem, did you solve this issue ?

Mobile Ads SDK Forum Advisor Prod

unread,
Jul 9, 2020, 4:21:51 AM7/9/20
to mehran....@gmail.com, google-adm...@googlegroups.com

Hi Mehran,

 

This thread had its last response back in January 2018, so it is unlikely that the original poster will respond to your post. Kindly create a new thread instead for your concerns so that we can assist you better on it.

 

Regards,

Ziv Yves Sanchez

Mobile Ads SDK Team



ref:_00D1U1174p._5004Q21kLVQ:ref
Reply all
Reply to author
Forward
0 new messages