1

I am using admob ads in my mobile app. When I gone through the guidelines I found the below statement.

If your app is automatically refreshing ads, make sure ad requests are not made when the screen is off. Also, if users navigate to and from pages with ads in an application over a short period of time, a new ad request should not be made sooner than the recommended 60 second rate.

https://support.google.com/admob/answer/3245199?hl=en

Can you please tell me what I need to do that for "make sure ad requests are not made when the screen is off"

I am using codova admob pro plugin in to integrate ads. https://github.com/floatinghotpot/cordova-admob-pro

and using the code

  if(AdMob) AdMob.createBanner( {
    adId: admobid.banner, 
    position: AdMob.AD_POSITION.TOP_CENTER, 
    autoShow: true } );

Thankyou.

Ram
  • 504
  • 3
  • 11
  • 1
    i think the device goes to sleep when the screen is off anyway so your app wil be suspended until you go back in -- http://stackoverflow.com/questions/5345344/app-seems-to-stop-working-when-the-screen-goes-to-sleep -- dont quote me on this though -- howver on devices you still get push notifications, such as new mail etc but you could turn off those too if the user wants to – Tasos Jan 01 '16 at 18:28

2 Answers2

3

You do not need to do anything. The ad unit is automatically paused when the screen is off or your activity goes in background. You can monitor the logcat to verify this.

At least this is seen to be happening with Mopub which i use to mediate admob.

Viral Patel
  • 32,418
  • 18
  • 82
  • 110
1

do not call your ad-refreshment code via service. Service can work in background even when app is not in foreground. Call the code through some activity or fragment, which will automatically pause as soon as it goes into background

Rusheel Jain
  • 843
  • 6
  • 20
  • First, I doubt if that is even possible. It has to be done from the activity. Second, he never mentioned anything about him refreshing it from a service? Do you read the questions before posting answers? – Viral Patel Jan 01 '16 at 19:02
  • I am unsure what was wrong in my answer. He never mentioned calling the code for ad - request from service, but the question does mentions how to ensure requests are not made when screen is off. Now if you make you code to call ads from service, the code will definitely work in background but not if called via activity/fragment. Maybe there are more DONTS than just what I mentioned but as I said, I couldnt find anything wrong in my answer wrt the question – Rusheel Jain Jan 01 '16 at 19:26