Does Admob performs requests when the app is in background? - android

I've integrated AdMob with my app. I can't seem to find this in any AdMob references.
Are AdMobs still running and bringing you revenue even if the app is in background or the ad is not visible? (for example
the user pressed the "Home" button
the user turned off the screen
the ad is positioned outside screen bounds
In my opinon this is clearly a wrong behavior if AdMob is still requesting ads and paying money per impressions in any of the above cases.
How does this actually work? Can anyone point me to a link/reference that exaplains this behavior?
Thanks

Clicking back, home, or closing your phone will pause your application but not terminate it. It is possible to run your application as a Service\WakeLock and it will continue to run in the background. Admob requests should not be running in the background if your application is paused. You should not be receiving impressions or revenue while your application is in the background.
Quote from AdMob: background requests?
You can see in LogCat when AdMob is requesting ad. Are you seeing any
requests when your app is in the foreground (you should), and when
your app pauses (you should not see any requests)?
By: Android Dev Guy

Related

How do I control the SmartLocks blue banner?

When the user starts the app, I'm able to retrieve a previously stored credential. When this happens, the blue SmartLock banner shows up. On the app I work on, this is covering a FAB making it unusable until the blue banner goes away. Is there a way to control the length of time the banner is shown? Additionally, is there a way to let the FAB move up like it would with a snackbar showing?
Lastly, if the user exits the app as the banner is showing, it will continue to show on the phone home screen, blocking any use of the bottom app bar. Is there a way to prevent this?
The auto sign-in banner is shown by Play Services and drawn over the app. The intent is to notify the user that their saved credentials have been retrieved and avoid app inadvertently not displaying or displaying the notification at an incongruous time or place.
Right now, there is not much flexibility about it, the banner won't be in the app view hierarchy and might cover other elements, such as floating action buttons, for a few seconds. In practice, we haven't found this to be much of an issue ... many apps have put the auto sign-in at start and it shows over a splash screen and only once per device install since most apps don't need to sign users out.
But fair concerns that if credentials might be retrieved frequently or user may interact or switch apps immediately after signing in. Do comment with any feedback/requests, examples of problematic scenarios, or suggestions of alternative UX or implementation we'll see if we can accommodate them.

How to make sure ad requests are not made when the screen is off

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.
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.
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

Blocking "Back" button to Close Interstitial Ad

I am adding interstitial ads to my android app using AdMob. I am wondering if there is a way to prevent users from closing them via pressing the "back" button (so they'd have to press the "x" button on the ad).
I know that AdMob is loading the ad in another activity, so I can't use my activity's onKeyDown() to do that.
Also, I am not sure if it's considered a good practice and if it's worth doing at all.
Thank you!
Update:
It appears that there is no easy way to override the back button in the ad's activity (since I don't have access to that activity). Thus, I'll give up on it.
However, I still haven't found any evidence that it is against admob or android policy. In most of android games the back button is overridden to turn the pause mode on and off (as opposed to go further back and eventually exit) and everyone seems to be okay with it. Therefore, I am still open to hear about this aspect from the people that actually know the answer.
P.S.: to the people that say that it's such a horrible thing to block the back button:
I agree that this would make it more annoying for users, but the very idea of interstitial ads is pretty annoying to begin with. Despite of that, it is the most commonly used type of ads these days (guess why - it's just more profitable).
Now, most of the time if you use the back button you can close the ad even before it is loaded on the screen (I'm talking about loading of the layout, not loading of the data from the ad provider). But the whole idea of having ads is to show them to people. So, I think it is reasonable to allow users to close the ad only after it is fully loaded to the screen and not before that. And people that are saying otherwise (but at the same time not having anything against the very concept of interstitial ads) are hypocritical.
Check Google/Android policy for overriding the Back button while publishing your app. Obviously they don't like it either as you disable a main feature from user stand-point.
But if you really need to avoid pressing the back button just override onBackPressed(), you can leave this function blanked.
If you subclass the AdMob activity, then you can override its onBackPressed method to do nothing.
This has recently been fixed by Google. If you update to SDK 19.3.0+ the back button will stop working when an interstitial ad is shown. You must now use the close or x button.
implementation 'com.google.android.gms:play-services-ads:19.6.0'
Source:
Can't dismiss Admob Interstitial Ads by pressing Back key button of Android device
Admob Interstitial ad is not closing when user presses back button on android 7,8,9 but works fine on android 10 and 6

Strange behavior after user clicks adMob ad

I have successfully added admob ads to my android app and can view test ads on the emulator and my development phone (Nexus One). When I click on one of the test ads, it opens the web browser or market to that particular page(gmail or whatever). I click the home button to exit, but when I try to start my app again, it takes me back to the market page or browser that came up when clicking the test ad.
I have a feeling it is something in the onLeaveApplication or onPresentScreen methods implemented with AdListener, but I'm lost and the adMob documentation doesn't provide much info on this.
Generally this is the expected behavior for an application. If you click home and then back on your application icon, most applications will jump back to the last activity on the stack. It's certainly possible to kill your application altogether and treat re-entry as a brand new instance of your application, but you probably don't want that either as all user state will be lost unless you explicitly save it, which is even more work.
The AdMob client SDK listener callbacks are all optional for you to implement; there's no expectation that you do anything in particular. They're there as a convenience for you to pause, save, or resume whatever activity you were doing before.
Users are generally used to hitting the back button to go back to your app, not home and then back into the app.

Android AdMob SDK - requesting a new Advert returns same Advert

I have an AdView in the main activity with its requestInterval set to (the recommended) 20 seconds.
The problem is that the Advert never seems to change.
I know that the refreshes are occurring as I get callbacks to onReceiveRefreshedAd on the AdListener, furthermore the impressions are being counted in the Sites and Apps Reporting control panel.
I can see that the AdView flickers just after the onReceiveRefreshedAd callback occurs, so my assumption is that AdMob is simply serving the same ad time after time.
The only way to get a new/different advert is to restart the activity.
This isn't the way its supposed to behave surely?
I'm not in test mode nor am I using a registered test device.
Thanks,
It is very common to return the same ad, as well as not returning any ads at all, the ads can have a specific target applications, which are with "higher" priority, so you are getting one of the ads that doesn't require anything in particular :)
EDIT: once your app becomes more popular, it will show different ads more frequently, so don't worry about it.

Categories

Resources