1
votes

I am loading ads in a static manner on Activity's onCreate() method if not already loaded and on onResume() method. I am showing ads after 3-4 intervals.

  1. Is it against google Admob's policy to show Interstitial ads on Activity onResume()?

  2. I've gone through this article, where it says: Do not place interstitial ads on app load, but not sure I am breaking it or not. am I?

  3. And if user gets a phone call while using app, when he hangs up, onResume() is called again. So, it might show an Interstitial ad. Am i breaking the law: It should be clear to the user which application the ad is associated with or implemented on, mentioned here?

Simplified version of my code is given:

AdmobInterstitial.java

public class AdmobInterstitial {

private static InterstitialAd mInterstitialAd;

public static InterstitialAd getInterstitial(final Context context) {
    if(mInterstitialAd==null)
    {
        final AdRequest adRequest= new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .build();

        mInterstitialAd = new InterstitialAd(context.getApplicationContext());
        mInterstitialAd.setAdUnitId(Utility.INTERSTITIAL);
        mInterstitialAd.setAdListener(new AdListener() {
            @Override
            public void onAdClosed() {

                mInterstitialAd.loadAd(adRequest);

            }

        });

        mInterstitialAd.loadAd(adRequest);
    }
    return mInterstitialAd;
}



public static void counter(Application app, ShowAdInterface mmActivity)
{
    SharedPreferences pref = app.getSharedPreferences(Utility.SHARED_PREF_NAME , MODE_PRIVATE);
    SharedPreferences.Editor editor = pref.edit();
    int my_counter=pref.getInt("banner_count",0);

    if(my_counter>0&& my_counter%3==0) {
        if(!mmActivity.showAd()) {
            my_counter--;
        }
    }

    my_counter++;
    editor.putInt("banner_count",my_counter);
    editor.apply();
}

}

ShowAdInterface

public interface ShowAdInterface {
    public boolean showAd();
}

MainActivity.java

public class MainActivity extends AppCompatActivity implements ShowAdInterface{

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mInterstitialAd= AdmobInterstitial.getInterstitial(this);
}

@Override
protected void onResume() {
    super.onResume();
    AdmobInterstitial.counter(getApplication(),this);
}
}
2

2 Answers

1
votes

I am using this kinda method and technique in many of my apps for many years now. Occassionally, every half a year, I get a mail from google admob about a little thing which they dislike. I usually wait for this to happen and then take action because they dont just ban you, they'll ask you nicely first. So just respond to that.

Anyway, regarding your matter: Always LOAD the ad on app load and show the ad in a manner, that no "accidental" clicks are produced. This is what google hates the most, so this is where you will get auto detected and receive a mail to change it. It really depens on your app. If you see the ad loading just fine without anyone accidentally clicking on them everthing is fine. So your code is probably ok, but debugging will give a finite answer! Good luck!

1
votes

I think it's alright. Until you don't take any accidental clicks from the user, you are good to go. We are loading ads onResume() and we didn't find any problem so far.