I'm a beginner in android development. The app I develop has 30 activities. I'm in the process of adding admob ads to my app. Can I add ads only to 10 of 30 activities. Is it ok to add ads to only 10 activities, is it correct. If not is there any shortcuts to add ads to all activities. Shortcut in the sense programmatically adding ads to one activity and extending it to all activities.
First thing is that there is no shortcut to add it to all activities.
For putting the ad into the activities you want, put the JAVA and XML code only in the activity you want to place the ad.
Gradle is common for the whole project.
My Personal Advice - Do more code and get the concepts more well before indulging in the Ads. They are a bit complex for beginners.
Related
I am trying to develop an application which have a single activity. I have achieved all the functionality using multiple fragments. I am showing advertisement using Admob in OnCreate of the activity.
Question:
Should I shift Admob code to OnCreate of each fragment for more impressions?
No. This might increase impressions but it not increase your revenue (revenue it a function of clicks not impressions) and may well decrease it (you may start getting lower value impressions because your CTR will drop). It will also unnecessarily complicate your code.
I've got following problem.
I got two different Activities in my Android application. Now I wanted to add an AdView on each of these activities.
It worked for me adding one adView to "BANNER" and the other one to "SMART_BANNER".
But now, when I try to set both AdViews (the one activity and the other activity), to "SMART_BANNER", I noticed that one of these Banners won't show up.
This made me ask several questions:
How many adViews am i allowed to implement in one app?
How many adVies am i allowed to implement in one single activity?
Why doesn't it work when using two SMART_BANNER in one app? Why does it work when using one BANNER and one SMART_BANNER adView in one class?
I hope you can help me.
It is against Admob TOS for you to display 2 AdViews on the one Activity.
But it is totally acceptable to display more than one AdView within your app. But in reality you only want to display AdViews where the user spends most of their time.
The question is in the context of Admob in Android.
In every activity, the admob ads is taking couple of seconds to load. I want that the Admob Ads should load instantly with the activity.
I have tried couple of solutions but nothing seems to work :(
So i thought of Frameset concept in HTML, if we click on the link, in a particular frame then only that part will refresh and the other part remains static.
So i was hoping for similar solutions in Android, where the admob ads remain static and the rest part of my activity changes accordingly.
Can anyone guide me, on how to implement similar functionality in Android ?
Also if you have any other alternative to the Admob Ads 0 seconds load time, kindly share it.
Admob takes about a couple of seconds because instruction to load admob is called only when activity started. That's why every admob is also reloaded as long as you reload your activity. In addition, this is often a remote call and could take a time.
Solution :
Create a main activity (which contain admob loading) which handle your set of fragments. I mean instead of using activities, you should use fragments handled by only one activity.
So, you can navigate between all of your views using fragment manager without making any change to admob loading (because it owns to main activity)
I am trying to add Admob in my android application which consists of over 15 activities. My question is which solution is the best one, considering that I can't extend any "BaseActivity" (for various reasons), as presented in this example: Admob on Multiple Activities? and I don't want to violate any agreements regarding rules making adds requests and their use.
So far i've created a file admob.xml containing the com.admob.android.ads.AdView
and I use "include layout" in each layout ".xml" file loaded in every activity.
Is this OK? Will I have any problems with Google policies or something like that? Or will this implementation cause me losing potential revenue?
That is a reasonable solution and complies with AdMob policies. Just make sure you don't have two banners on the same page.
The Best way is to switch to fragments,
Your main application will be in the main fragment, and your ad in the Ad Fragment.
This way you can switch your previus activities with fragments, and you will need to initialize the ad Fragment only once, also this will prevent new ad request when you create a new activity (which can lower your admob RPM).
Eli
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