need a little AdMob help.

Monkey Forums/Monkey Programming/need a little AdMob help.

Paul - Taiphoz(Posted 2013) [#1]
Hay all.

Initially I wanted to see what the add's looked like so tried the example in the docs, I filled in my pub-####### and my device id, and ran the app.

but no add's become visible, I tried throwing add width to the screen and it comes back as zero so I assume it's not getting adds ?

am I missing something ?


benmc(Posted 2013) [#2]
If you are testing on Android, run ddms at the same time and you will see if it's throwing a "no ads" error possibly. Also, if you just recently created the ad in AdMob, I've found it takes a while for actual ads to appear, and I will often times run a House Ad in testing to see what the ads look like - and it seems to work almost right away (typically).


Paul - Taiphoz(Posted 2013) [#3]
I might not be doing the admob add side of things right , is there a complete guide anywhere that covers everything from creating an add to getting it into a game .


silentshark(Posted 2013) [#4]
u still stuck on this? If so, I will post what I did to use Admob in v70..


Paul - Taiphoz(Posted 2013) [#5]
Yeah post it pls , can you include how to correctly add an app and add on the add mob site as well, it will help me out a lot.


silentshark(Posted 2013) [#6]
ok, here's what I have done. This was in Monkey v70.

1. Register your account with admob, and create a new app in admob.
2. Note the published ID for the app carefully. This is a string of characters, e.g. a14fe55e66432e9
3. Make the first line of your Monkey program read
#ADMOB_PUBLISHER_ID="a14fe55e66432e9"

(as an alternative, you can set this in the config file in the build/android folder if you want)
4. Make sure you are importing the admob module in your Monkey program. You'll want a line like the following near the top of your program:
Import brl.admob

5. In your OnCreate() method, call the admob functions to get it to display:
admob=Admob.GetAdmob()
admob.ShowAdView 1,layout

Note you will need to declare the variables used by this module. I did this as follows:
' Class for main game
Class game Extends App

Field admob:Admob
Field layout:=2
Field enabled:=True

That's it! HTH!


Paul - Taiphoz(Posted 2013) [#7]
Thanks that did indeed help.



The config #ADMOB_PUBLISHER_ID requests the Publisher ID, that would be the ID in the top right yes ? where I have marked, but it's actually the Ad Unit ID, the ID attached to the Ad created for the app..

So am I doing something wrong or does mark need to change the name of this, because at the moment it's causing confusion.


Paul - Taiphoz(Posted 2013) [#8]
Also, the add's can we change their size ? I need a longer thinner add, not the little banner fat one that it's using now.


Nobuyuki(Posted 2013) [#9]
ad sizes are standardized for the most part. Smart ads are for tablet-size form factors (and afaik aren't supported by monkey's admob module yet anyway), so they won't help you get more screen real estate back.


Paul - Taiphoz(Posted 2013) [#10]
Yeah I hope he does support them tho, I think will eventually become the standard once more networks start to use them, because they are a lot more flexible.


Xaron(Posted 2013) [#11]
Well actually you can change that and I think Mark should change the default as well.

For Android open modules/brl/native/admob.android.java

Go to line 70 and replace
_adView=new AdView( activity,AdSize.BANNER,MonkeyConfig.ADMOB_PUBLISHER_ID );


with

_adView=new AdView( activity,AdSize.SMART_BANNER,MonkeyConfig.ADMOB_PUBLISHER_ID );


For iOS open modules/brl/native/admob.ios.cpp

Go to line 45 and replace
_view=[[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];


for portrait apps with
_view=[[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerPortrait];


for landscape apps with
_view=[[GADBannerView alloc] initWithAdSize:kGADAdSizeSmartBannerLandscape];



Snader(Posted 2013) [#12]
Thanx Xaron, very helpfull!


Paul - Taiphoz(Posted 2013) [#13]
At the moment there is only one style, 1, which is the fat banner would it not be better to create a second style 2 that uses the smartbanner, that way we have access to both.

I also hope mark changes this I really , as a personal thing do not like to mess with his code because I know I would have to change it again after any updates, and we all know they come fast.

last thing I want to do is get into the habbit of hacking his code and then each update having to go through redoing all the hacks.

that information is very very helpful tho Xaron, thanks very much, at least if mark does not add it I have a way to do it myself, as a last resort.


Paul - Taiphoz(Posted 2013) [#14]
without testing......

would this not be much better, I think it's what mark had in mind anyway given the _style paramater..

@line 70
		switch( _adStyle ){
			case 1:_adView=new AdView( activity,AdSize.BANNER,MonkeyConfig.ADMOB_PUBLISHER_ID );break;
			case 2:_adView=new AdView( activity,AdSize.SMART_BANNER,MonkeyConfig.ADMOB_PUBLISHER_ID );break;
		}



Edit : Tested works like a charm, thanks again Xaron for pointing me in the right direction.


silentshark(Posted 2013) [#15]
I have been using the same hack to use the SMART_BANNER ads, and can confirm it to works fine. SMART_BANNER ads seem to sometimes use up the whole width, and appear a sensible size, but not always. I think that's just the nature of them, not a monkey admob issue..


Paul - Taiphoz(Posted 2013) [#16]
Yeah it's well handy, not had any problems with it so far, Another quick Admob question for those you who have used it longer than me.

At the moment I am displaying my fat banner add on the menu, I then hide it when I goto the game and show it again in its smart banner format, is that the best way to handle it or do you guys have more than one add in game at a time ?


marksibly(Posted 2013) [#17]
Just looking at adding this SMART_BANNER option, which is no problem on Android but on iOS there are 2 options here...

kGADAdSizeSmartBannerPortrait
kGADAdSizeSmartBannerLandscape

What's the difference (docs are vague)?

Which one should I use?

[edit]
How about, 2=SmartBannerPortrait, 3=SmartBannerLandscape on iOS, but both just mean SmartBanner on Android?
[/edit]


Xaron(Posted 2013) [#18]
Yes that sounds good, Mark! :)


Paul - Taiphoz(Posted 2013) [#19]
As I understand it the way the smart banners dynamically stretch differs a little between portrait and landscape on iOS, something they have done to make it look nicer I guess.

I think that solution is fine, it would mean that if Android ever did make a change so there was a difference it would be easier for you to implement that without us having to change our code, we would just use the right banner type for the right aspect ratio.


therevills(Posted 2014) [#20]
I've successfully added AdMob to my game... but even days after its been published on Google Play, AdMob wont let me link it up...

Does it matter if I cant?

If it does, how long does it normally take AdMob to "see" new games/apps?


Paul - Taiphoz(Posted 2014) [#21]
Are you going to the Link to App, and then searching for your app ? that's always worked for me, what error or whats happening when you try ?

EDIT : I just added a game today, and its not found but the link search so I guess there is a lag between an app being added and then the admob search being able to find it, I can only assume that admob is searching an internal cache of the stores and not the live stores themselves otherwise it would find it instantly.

who knows


therevills(Posted 2014) [#22]
A few screenshots of what I am doing:

1. Going to Link to App:


2. Searching for the Game:


3. Searching for the Developer Name:


Can't find my game :(


Paul - Taiphoz(Posted 2014) [#23]
see my above edit. I might tweet them and find out for sure.


rIKmAN(Posted 2014) [#24]
Can either of you confirm that SmartBanners work?

I am running the example from the docs with my AdMob details in it and it works fine in Bluestacks - clicking hides the add, and changes the layout from top left to centre, top right etc

However if I change the style to 2 (smartbanner portrait) or 3 (smartbanner landscape) then run the example again, then nothing is displayed and I get an error every time I click (to show an ad):
E/ActivityThread( 1819): Failed to find provider info for com.google.plus.platform


I've tested using the latest stable release v77f.

EDIT:
Seems it may be because the Ad Provider does not support SmartBanner style, although I am just using the default ones that are set when you create an AdMob account.


rIKmAN(Posted 2014) [#25]
Can either of you confirm that SmartBanners work?

I am running the example from the docs with my AdMob details in it and it works fine as it is written in Bluestacks - clicking hides the add, and changes the layout from top left to centre, top right etc

However if I change the style to 2 (smartbanner portrait) or 3 (smartbanner landscape) then run the example again, then nothing is displayed and I get an error every time I click (to show an ad):
E/ActivityThread( 1819): Failed to find provider info for com.google.plus.platform


Is it something I'm doing or an error because I am using #ADMOB_ANDROID_TEST_DEVICE1="TEST_EMULATOR"?

I've tested using the latest stable release v77f.

Any help appreciated.


Ironstorm(Posted 2014) [#26]
Hm. Used v77f, too. Worked here. The ad gets displayed after 3 or 5 seconds.

Your error is because you haven't installed the Google+ app. Admob tries to gather over this app some user information to display user related ads. But the smartbanner as other banner styles should work, even Google+ isn't installed.


rIKmAN(Posted 2014) [#27]
No, as I say even SmartBanner ads are not working.

When you mention the Google+ app, what is this?
You have to install that to make adverts work?
Is this just for interstitials?


Gerry Quinn(Posted 2014) [#28]
For testing ads, I find that the emulator starts displaying a test ad right away when I set up banner ads.

With regard to linking, I don't even know what that is, but Admob have always started recording impressions within a couple of days of putting the app on distribution - and nearly all the initial downloads come via SlideMe.


Ironstorm(Posted 2014) [#29]
Sorry, I wasn't clear enough.
I mean, your "error" isn't related to your smartbanner-problem. It occurs only, because admob tries to get some user information from Google+. And as I said, admob should work even without Google+ installed.
You can read a similar problem here: http://stackoverflow.com/questions/17390573/failed-to-find-provider-info-for-com-google-plus-platform

Back to your smartbanner-problem. I've tested the example from the docs with Smartbanner. And it worked on my device as well in the emulator. So there seems to be a problem with your device, or your settings. Because the code works fine. With which device do you test the code?


rIKmAN(Posted 2014) [#30]
Thanks for the info Ironstorm.

I was testing on Android using BlueStacks emulator, but I am going to test SmartBanners on iOS now using my device and will report back as to whether that works or not.

Interstitials are Android only atm, which is why I was using BlueStacks to start with.


rIKmAN(Posted 2014) [#31]
In the admob example from the docs, I get ads if I run it "as-is" with the banner style set to 1, but if I change it to 2 or 3 (smartbanners) in both lines I get nothing displayed at all, even leaving it for minutes so it isn't a refresh problem.

I don't think it's a problem with my AdMob account or using BlueStacks etc either, as like I say I get the standard banner ads with the exact same code except the style changing from 1 to one of the smart banner types (2 or 3).

Any ideas?
Could anyone test to see if it is just me?

Cheers.


therevills(Posted 2014) [#32]
There are 3 styles for AdMob, because for some reason in iOS you can set Portrait or Landscape for the Smart Banners.

For Android it is either a normal banner or a Smart Banner.
AdSize sz=AdSize.BANNER;
switch( _adStyle ){
case 2:sz=AdSize.SMART_BANNER;break;
case 3:sz=AdSize.SMART_BANNER;break;
}


As you can see for Android there is no difference if you pass in a 2 or 3 for Android.

What version of AdMobs are you using?


rIKmAN(Posted 2014) [#33]
I'm using the admob example from the Monkey docs, cut and pasted into a runnable .monkey file.


therevills(Posted 2014) [#34]
Sorry, in the AdMobs website are you upgraded to the new AdMobs or are you still using the "old" version?

So you are trying this example: http://www.monkeycoder.co.nz/docs/html/examples/brl_admob_Admob.monkey

Try without the test devices, I havent used them myself.


rIKmAN(Posted 2014) [#35]
Ah, I wasn't a member until last week so I think I'm on the new Admob.

Yes that's the example I am using, which works fine.
Changing the line below gives me nothing
admob.ShowAdView 1,layout

to
admob.ShowAdView 2,layout



therevills(Posted 2014) [#36]
Can you post the entire Android log file when you are trying to display the Ads?