problem on interstitial on finish activity

527 views
Skip to first unread message

Marco Pinotti

unread,
Jan 3, 2014, 8:55:45 AM1/3/14
to google-adm...@googlegroups.com

I have a problem with admob interstitial on finish activity.

i have implemented this, i call ad on backpressed or exit pressed in-app.

public void onReceiveAd(Ad ad) {
     Log.d("OK", "Received ad");
        if (ad == interstitial) {
              interstitial.show();
              pubblicita = 1;      
        }
  }

@Override
public void onDismissScreen(Ad arg0) {
    Intent intent = new Intent(this, DiarioSegreto.class);
    intent.putExtra("EXIT", true);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(intent);
    this.finish();

}

@Override
public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
    Intent intent = new Intent(this, DiarioSegreto.class);
    intent.putExtra("EXIT", true);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(intent);
    this.finish();
}



public void onBackPressed(){
    // se connesso carico pubblicita'
    if (isConnected) {
        // Create the interstitial
        interstitial = new InterstitialAd(this,
                "xxx");
        // Create ad request
        AdRequest adRequest = new AdRequest();
        // Begin loading your interstitial
        interstitial.loadAd(adRequest);
        // Set Ad Listener to use the callbacks below
        interstitial.setAdListener(this);

    } else {
        Intent intent = new Intent(this, DiarioSegreto.class);
        intent.putExtra("EXIT", true);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        startActivity(intent);
        this.finish();
    }
 }

but with slow connection none of these are called back and my app don't close, i need a way to close my app after few seconds of inactivity or another workaround...

William Ferguson

unread,
Jan 4, 2014, 3:17:40 AM1/4/14
to google-adm...@googlegroups.com
OK, I can see several problems here.

1) Don't show the Interstitial as soon as it becomes available. Doing so means you have no control over when it will be displayed. This results in a very poor user experience and bad ratings. Instead check to see if you have an ad to show ant a natural break in your app and if so, show it then.

2) Attempting to ask for and show an ad when the exit attempts to exit your Activity is also not a good user experience. And unless your have a super fast connection is never going to result in an ad before a user gets really annoyed with your app.

William
Reply all
Reply to author
Forward
0 new messages