Showing Admob Interstitial ads on Activity onResume()











up vote
1
down vote

favorite












I am loading ads in a static manner on Activity onCreate() if not already loaded and on onResume(), 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);
}
}









share|improve this question


























    up vote
    1
    down vote

    favorite












    I am loading ads in a static manner on Activity onCreate() if not already loaded and on onResume(), 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);
    }
    }









    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I am loading ads in a static manner on Activity onCreate() if not already loaded and on onResume(), 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);
      }
      }









      share|improve this question













      I am loading ads in a static manner on Activity onCreate() if not already loaded and on onResume(), 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);
      }
      }






      android admob interstitial






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 8 at 11:03









      Touhidul Islam

      19010




      19010
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          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!






          share|improve this answer




























            up vote
            1
            down vote













            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.






            share|improve this answer





















              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














               

              draft saved


              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206434%2fshowing-admob-interstitial-ads-on-activity-onresume%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              1
              down vote













              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!






              share|improve this answer

























                up vote
                1
                down vote













                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!






                share|improve this answer























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  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!






                  share|improve this answer












                  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!







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 8 at 11:30









                  innomotion media

                  324110




                  324110
























                      up vote
                      1
                      down vote













                      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.






                      share|improve this answer

























                        up vote
                        1
                        down vote













                        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.






                        share|improve this answer























                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          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.






                          share|improve this answer












                          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.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 8 at 12:28









                          Sifat Ullah Chowdhury

                          814




                          814






























                               

                              draft saved


                              draft discarded



















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53206434%2fshowing-admob-interstitial-ads-on-activity-onresume%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Schultheiß

                              Verwaltungsgliederung Dänemarks

                              Liste der Kulturdenkmale in Wilsdruff