what is the best way to display banner in android app? - android

i'm looking for a solution to be able to display, manage and control a banner in my app being able to change the banner in future. I've already tried ad mob and its house ad feature. but it seems that it also displays random ads provided by google.

Since you want to display something so specific, AdMob seems inappropriate. I suggest just creating your own layout to display exactly what you want. You can even create a custom View which can easily be reused wherever you wish.

Related

Google AdMob banner ad in NavigationDrawer

I couldn't find a solid answer for that:
is it valid to put AdMob banner ad inside NavigationDrawer (the drawer shrinks a bit the size of the banner), or is it violates the policy of AdMob?
I don't think it's a good idea to place it there.
So first of all, why do you have an Ad in your app? - To get some revenue from displaying it of course!
Your approach isn't ideal because:
Not all users will click the navigation drawer button in order to see the info you display there, including the ad;
Unless you live in US, you are not getting paid from people just viewing your banner, you need clicks in order to get revenue.
In my opinion, just place the add at the bottom of your activity, like I did in this image.

Can admob banner ads be applied on Dialog? Or its against google ads placement policies

I have custom dialog in my app, they popup when some event occur.
I am thinking to put banner ads on my app dialog popups.
Will that be a good practice ,or its against google banner ads placement policy ?
Even I had the same problem. You cannot use them in Dialog box as the ads wont appear.
This could work (you can display an AdView in a PopupWindow, for example), but if the dialogs come up quickly and disappear quickly, it doesn't give the user much time to see and interact with the banner, which can lead to lower clickthrough rates and less revenue for you.
I'd recommend looking at our Interstitial format. You could load them in advance, and display them when the user closes a dialog. If the dialogs are really frequent, you could only show an ad every fifth time, etc.
I've seen many games and apps that have ads on dialog boxes, so it's possible to do so.

How to avoid re-loading of Admob ads upon configuration change and starting an Activity?

Using the banners sample here, I noticed that if I change the orientation, the ad is gone, and then reloads itself (takes time), so there is a time that nothing is shown, each time I change orientation.
I know it's possible to set configChanges for the activity via the manifest (and it actually works), but this is not a recommended thing to do in general. It has multiple flaws:
In my case, for example, changing the orientation let the toolbar stay on the same height, which is wrong because it should be different on landscape than on portrait.
Going to another Activity the Admob view will still get re-loaded, even though it was loaded before.
When going from portrait to landscape, and vice versa, the ad doesn't get to fit well on the new orientation.
What else can be done to avoid re-loading of ads, on each configuration change?
I want Admob to load ads once (and the rest in the background, for new ones), and then show them, and avoid re-loading when I change orientation. Just show what's best for the current configuration (orientation for example), each time I reach it.
Same goes for going to a new Activity that has an Admob ad. If it loaded before, no need to re-load.
EDIT: I've put a bounty on this, because Google/Firebase support told me via email it's actually possible to cache the ads:
The Ads SDK won't cache ads for you, however you can implement an
'AdManager' style class, most likely a singleton or an instance
attached to your application instance, which can manage caching for
you.
As you recognize it's an Android pattern to destroy and recreate
activities on orientation, instance state is usually saved and
restored via a bundle, but this is not applicable to views.
If you wish to optimize the reload time of the banner view in this
scenario, I would recommend making your ad request via an AdManager
class, and the AdManager can then apply some logic to cache ads such
as your banner view for a certain amount of time, and return the
previous banner if it is still valid for the new request (which you
would make on orientation change).
And :
This idea of caching ads is not implemented by the SDK, as it is
difficult to determine the best caching logic to apply in all cases,
thus it is left to the developer to implement caching that suits their
use case, if desired.
Possibly having a banner ad decoupled from the 'AdView' class would
make for more appropriate cacheable objects, however this is not
currently the case.
Therefore as it is, yes we suggest that in order to prefetch / cache a
banner ad, you need to store the 'AdView'. Instead of using an
AdManager however, another supported and indeed recommended approach
would be to use a ViewModel, see
https://developer.android.com/guide/topics/resources/runtime-changes#RetainingAnObject
and
https://developer.android.com/topic/libraries/architecture/viewmodel.
These are designed for exactly this kind of use case.
If it is indeed possible, I'd like to know exactly how to do it. Please, whoever succeeds in doing it, show in code what can be done.
I don't see clear way how to cache ordinary ads. Nor singleton, nor viewmodel won't help, we can't cache/retain the view itself and there is no public ad object to retain.
However there is AdLoader using which one can load native ads, and retain loaded UnifiedNativeAd object. Then it can be used to set ad in view.
Other ad sdks provide way to prefetch ads though.
P.S. dunno why stack brought this in search results for "android viewmodel" query
Seems that having a native ad is the best option instead of configChanges . The pure data can be saved on the ViewModel of the Fragment/Activity, for example, so that you could re-use it again.
Sadly though, it's a solution you have to implement yourself, including not just how it looks, but also the loading procedure itself, including when to reload it yourself.
There is a lot to read and to implement based on a person's need, so best thing to start is from :
https://developers.google.com/admob/android/native/start
Not sure though if in terms of income, it's about the same as banner ads.
i think that using smart banner would be a good option, because they work for any orientation
To use Smart Banners, specify the constant SMART_BANNER for the ad size:
AdView adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);
also check this:
https://firebase.google.com/docs/admob/android/banner#smart_banners

admob advanced filtering of ads (managing filters)

I have few admob sites and for each of them I want to set different filer for the content of the banners.
I want to do some manipulation with admob filter, unfortunately I do not even know the basics.
I want to show ads that contain image and no text (ads with image only)
How to do this ?
I want to show ads that look like this (no phone)
I want to show ads that have phones like this
For #1, if you disable AdSense backfill you can get rid of a lot of these text ads. The AdMob network itself is not guaranteed to only have image ads though, so it doesn't fully solve this problem. In addition, the fill rate on your ad slot would be much lower if you disable backfill, so this is generally not recommended.
For #2 and #3, the AdMob filters that are in place are ad category filters and language filters. As far as I know, there is not support for ad type filters.

Android: Admob doesn't work on multiple pages?

I was able to setup admob in my app but it only shows in the first page where i first setup. I copied same code on different activity and layout but these never appear. Any idea why? and is it possible to display admob on different layout xml?
thanks.
I see this working in the way you describe it in other ways, so I guess it should definitely be possible to have Ads on multiple pages.
Have you tried putting your ads into test mode- do they appear by then? If not you probably have a different problem (like layout etc..)
http://developer.admob.com/wiki/Android

Categories

Resources