Admob Interstitial Ad Module - Android Only

Monkey Forums/Monkey Code/Admob Interstitial Ad Module - Android Only

therevills(Posted 2014) [#1]
Create the native code:
NEW ANDROID TARGET:
admobInterstitial.java


OLD ANDROID TARGET:
admobInterstitial.java


Create the Monkey code:
admobInterstitial.monkey


Example:


It does take some time to load an Interstitial Ad, so if it does not appear straight away wait a few seconds and try again...


silentshark(Posted 2014) [#2]
Great - many thanks for this, will give it a whirl..

Are there any dependencies in terms the version of Monkey (or other dependencies, come to think of it)?


Volker(Posted 2014) [#3]
Looks good. It took me ten times longer to upgrade my AdMob account to the new version to get the Interstitial ad unit id
then to get the monkey stuff running.
Works fine here on two devices.


Snader(Posted 2014) [#4]
Great! I will implement this soon! Thank you very much!


silentshark(Posted 2014) [#5]
@Volker what's the deal then with "new admob", are there reasons to upgrade (other than the interstitial ids). Is there a downside to upgrading?


Paul - Taiphoz(Posted 2014) [#6]
Oh this will be perfect for Hex, I had to remove ad's from its game play area as they were obscuring to much of the board, leaving ad's only on the menu, which is fine I guess but reduces the chance of clicks, so with this I can slap in an additional interstitial just before a game starts.

Therevills you need to submit this to the repo once your happy with it so mark can pull it.


Volker(Posted 2014) [#7]
Is there a downside to upgrading?

I dont fully know yet. You have to reenter a lot of stuff which can't be imported from the old one like payments details, bank account information and credit card information.
They transfer a small amount to your bank account and you have to prove it again.


Paul - Taiphoz(Posted 2014) [#8]
Tested , works like a charm on the GS4.


Paul - Taiphoz(Posted 2014) [#9]
EDIT- never mind.


Gerry Quinn(Posted 2014) [#10]
I presume you should load the next interstitial early so it will be ready to show at end of level or whatever?


therevills(Posted 2014) [#11]
You can see it working on Flying Flappy Monkey:

https://play.google.com/store/apps/details?id=com.therevillsgames.flyingflappymonkey

Are there any dependencies in terms the version of Monkey (or other dependencies, come to think of it)?

It requires the use of the GoogleAdMobAdsSdk-6.4.1.jar which is included in Monkey since the introduction of brl.admob stuff... so any version with that should work...

Is there a downside to upgrading?

You will have to upgrade sooner or later... best get it over with :)

Therevills you need to submit this to the repo once your happy with it so mark can pull it.

Since this is only for Android, he may only accept it if there is an iOS module... (which doesn't look to hard to do, but I don't do iOS development anymore...)

I presume you should load the next interstitial early so it will be ready to show at end of level or whatever?

The code kind of does that for you anyway... I should explain for it works:

1. Declare the field:
Field admob:AdmobInterstitial


2. Instantiate the object:
admob = AdmobInterstitial.GetAdmobInterstitial("your Interstitial ad unit id")

This creates the admob object and starts it.... AND gets the first ad for you. Also there is an Ad Listener which tracks when you close the Ad and loads the next one for you - I found out that if you don't load another Ad it doesn't display the last one, so I changed it so it will always gets another Ad when you close the current one.

3. Use the method ShowAd to display the Ad... it will only display the Ad if it is ready.

Hope that helps!


silentshark(Posted 2014) [#12]
therevills - great. thanks for your sharing your work :-)


Gerry Quinn(Posted 2014) [#13]
Ah, I see. I was misled by your mention of a few seconds delay.

Thanks for this. Banner ads are fine for some games, but clearly for others interstitial is the only way to go.


therevills(Posted 2014) [#14]
I was misled by your mention of a few seconds delay.

Yeah that's really only for the example code, if you check out Flying Flappy Monkey I only display the Interstitial Ad after "Game Over".

So the game starts and gets the first Ad, the player plays the game and dies and hopefully the Ad is now ready if not it "should" be ready next time... once displayed it then gets the next Ad and repeats the process.


Paul - Taiphoz(Posted 2014) [#15]
Not sure why your having speed issue's mate its lighting quick for me, for the test I tap bingo ad. no delay, although in my game I am prepping it first and then displaying it just before actual gameplay starts, with banner ad's on display during the game's menus.

I think a really good approach to the whole banner or ad issue will be using both, Banner ad's for those menu type screens where no actual game play is taking place, and then either/or an Interstitial before/after actual gameplay, that way the player is not being distracted by a banner over their play area and you as a developer are not having to give up screen space for it.


SLotman(Posted 2014) [#16]
There is one downside to upgrade (at least for me): Google will stop paying through paypal, which for me means paying tons of taxes to receive money. As long as I can, I'm not upgrading to this "new admob" =(


rIKmAN(Posted 2014) [#17]
Great work therevills!

What would be involved in making this work for iOS?

Maybe if Mark seeing the Android version here he would be compelled to add the iOS version himself - it's definitely a feature most people want. (hint hint Mark ;))


therevills(Posted 2014) [#18]
@Paul
Not sure why your having speed issue's mate its lighting quick for me, for the test I tap bingo ad. no delay, although in my game I am prepping it first and then displaying it just before actual gameplay starts, with banner ad's on display during the game's menus.

Must be an internet speed issue... just be aware that they can be slow :)

@rik
What would be involved in making this work for iOS?

Off you go:
https://developers.google.com/mobile-ads-sdk/docs/admob/advanced#ios

:D


SLotman(Posted 2014) [#19]
Is it really necessary to upgrade to the "new admob" to use those kind of ads? Or a regular id from the old admob would work?


Gerry Quinn(Posted 2014) [#20]
I'm stuck on new Admob anyway, I think, I only joined in November. Surprised they would have being paying at all through PayPal, though, they seem to be at war with them for a long time due to Google Checkout! (And as usual, us civilians are the victims...)


silentshark(Posted 2014) [#21]
I'd be interested, too to know if "new admob" is a hard requirement for interstitials. I looked at some of the google docs, and coudln't see any mention of this, but might have missed it.


therevills(Posted 2014) [#22]
I've only recently started to use AdMob so I have only ever used the "new" AdMob... but there are threads on the net back in 2012 talking about interstitials.

All I can suggest is that try the above module and input your AdUnitID and see if it works :)


rIKmAN(Posted 2014) [#23]
Thanks for the link therevills - added to my reading list.

Time to go setup and AdMob account :)


Xaron(Posted 2014) [#24]
I like the new Admob. And they support WP8 there which is awesome!


Paul - Taiphoz(Posted 2014) [#25]
I think I actually had the old one but was not actively using it yet so when the upgrade kicked in I just clicked it without much of a thought.


therevills(Posted 2014) [#26]
Here are some figures from Flying Flappy Monkey Ad campaign:

Banner Ad (started 15/02/2014):
Requests	Impressions	Fill rate	Clicks	Impression CTR	Request RPM	Impression RPM	Estimated earnings
11,809		11,704		99.89%		13	0.11%		AU$0.10		AU$0.10		AU$1.15

Interstitial Ad (started 21/02/2014):
Requests	Impressions	Fill rate	Clicks	Impression CTR	Request RPM	Impression RPM	Estimated earnings
2,597		2,363		99.88%		140	5.92%		AU$6.37		AU$7.00		AU$16.54


So far Interstitial are the way to go! :)


Paul - Taiphoz(Posted 2014) [#27]
Those are some nice numbers, did you post that game anywhere else other than here ? and googleplay ?


Snader(Posted 2014) [#28]
When is the Interstitial Ad shown? Ingame or at the start or end of the game?


therevills(Posted 2014) [#29]
@Paul - it is currently only on Google Play.

@Snader - I show the ad every time the play "dies", after the Game Over state... A little too much for such a simple game but this is my test project for IAP and Ads ;)


Paul - Taiphoz(Posted 2014) [#30]
What I have done with Swim Jelly Swim is a counter, so every (i forget might be 5) deaths the ad will show, since people die a lot and often in a short period of time this gets the ad display in but does it without slamming it in their face every single time.


rIKmAN(Posted 2014) [#31]
This is going to sound dumb - but are those figures from people clicking an ad advertising your game, or clicking an AdMob ad from within you game?
I thought it would be the latter, but you said "ad campaign" so I'm not sure now.

Interstitials easily win out either way.


Snader(Posted 2014) [#32]
I have succesfully used your module therevills. Now lets see what difference it makes..

Worked flawless by the way!


AdamRedwoods(Posted 2014) [#33]
i wonder if you could put up a fake "click to start" game screen over the ad, then you could get that CPC even higher! (evil, i know).


therevills(Posted 2014) [#34]
@rIKmAN
but are those figures from people clicking an ad advertising your game, or clicking an AdMob ad from within you game?

Just AdMob - impressions and clicks.

@Snader - Good hear... now if you can direct your ad revenue to my bank account that would be great ;)


SLotman(Posted 2014) [#35]
i wonder if you could put up a fake "click to start" game screen over the ad, then you could get that CPC even higher! (evil, i know).

Things like that get people banned from using admob... if you plan to do this, be aware it's against their rules.


rIKmAN(Posted 2014) [#36]
I'm having the same problem with this as with the SmartBanners - as in them not appearing and getting an error about providers.

Is there something I need to change from the default setup to get these working?


therevills(Posted 2014) [#37]
As Ironstorm has said in the other thread your error message is due to that your device does not have Google+ installed, it doesn't stop the Ads displaying or shouldn't - I get the same error but the Ads still display fine.

Ads can take a little time to load, normally for me a banner Ad takes around 3-4 seconds to display and the full screen Ads can take longer.


rIKmAN(Posted 2014) [#38]
Ah yeah that explains the error, thanks.

I still see no ads with your interstitial example though (or smartbanners in the other thread).
The only ads that seem to work for me are standard banner (style = 1)


therevills(Posted 2014) [#39]
@Rik - What version of MonkeyX are you using? What device are you using?

I've haven't used BlueStacks just "pure" AdMobs.... and I've only used Banner and Interstitial Ads...


rIKmAN(Posted 2014) [#40]
Hey therevills,

I first tried using v76d (the version used in my game) and also afterwards I tried v77f and had the same problem.

BlueStacks is an Android emulator which works fine when using "style = 1" in the admob example code from the docs.
If it is changed to a 2 or 3 (as per the docs) then I see nothing, and the same with your interstitial example.

I am not saying it's your code, obviously it works, but I'm puzzled as to what the problem is as like I say the normal banners work fine.


therevills(Posted 2014) [#41]
More stats, I've recently added AdMob to my old Pirate TriPeaks Solitaire game and released the updated APK on the 8th March:

Banner Ads:
Requests  Impressions Fill rate Clicks  Impression CTR  Request RPM Impression RPM  Estimated earnings
39,332    39,284      100.00%   84      0.21%           AU$0.32     AU$0.32         AU$12.73


Interstitial Ads:
Requests  Impressions Fill rate Clicks  Impression CTR  Request RPM Impression RPM  Estimated earnings
19,117    17,806      99.93%    342     1.92%           AU$2.31     AU$2.47         AU$44.07



erebel55(Posted 2014) [#42]
Has anyone gotten this to work on ios yet?


therevills(Posted 2014) [#43]
Has anyone gotten this to work on ios yet?

The code is just here for anyone to run with it:
https://developers.google.com/mobile-ads-sdk/docs/admob/advanced#ios


erebel55(Posted 2014) [#44]
I have no objective c experience, I have been working on it but sadly haven't gotten too far yet.
I have opened a thread if anyone wants to help http://www.monkeycoder.co.nz/Community/posts.php?topic=8235


rIKmAN(Posted 2014) [#45]
Hey therevills,

Just wondering if you had encountered the interstitials always being the same ad, over and over 99% of the time?

I'm not sure if it's an admob setup problem (in the CP) or the modules, as it happens with both your Android code and the iOS one erebel555 wrote.

I started discussing it in erebels iOS thread before I realised your Android code had the same result, thread here: http://www.monkeycoder.co.nz/Community/posts.php?topic=8235&page=1

Any ideas on what the issue might be?


erebel55(Posted 2014) [#46]
I am also HIGHLY interested in this


therevills(Posted 2014) [#47]
Any ideas on what the issue might be?

Since we dont control which ads are displayed I would guess its whatever Admob sends us. I've seen different ads in a row and I have also seen the same ads in a row too.

I have only tested this on an actual device.


rIKmAN(Posted 2014) [#48]
I've tested iPhone and iPad with a device, and Android using Bluestacks with the same result.

I'm not saying your code or erebels code is at fault, it seems like a setup problem in admob to me, although I'm not sure what and it seems strange that there would only be 1 advert between Admob / eFloor beta and iAds (which are what providers I have setup).

I'll keep an eye on it and report back if it gets better or not.


erebel55(Posted 2014) [#49]
So, I tested this in my normal game flow and it seems to be giving me a lot better variety now. I only show the ad every 5 deaths. So, either admob was acting up when we tested yesterday. Or more likely if you keep requesting ads from the same device without proper time in between requests it will give bad results. Try testing with a decent amount of time in between requests and let me know what you see.

Also, have you seen any video ads or ads with sound?


Supertino(Posted 2014) [#50]
Anyone know of a good article around when to use INTERSTITIAL ads? Looking to replace the banners in my games with them but I am not sure when in game to use them to not annoy users while being effective.

Thinking of one or a combination of;

- after x number of levels
- when returning from the game to the main menu
- when exiting the app
- after x minutes have passed display when next not 'in game'


CGV(Posted 2014) [#51]
When exiting the app would really piss me off.
When the player is done, let him be done.


Supertino(Posted 2014) [#52]
I just implemented this into my current project, worked like a charm (not using Diddy BTW) - thanks Rev =)


SLotman(Posted 2014) [#53]
Just to comment: tried it here, and it is working like a charm! (Monkey 77b, "old" admob, tested both on Bluestacks and in my really old and crappy chinese android 2.2 tablet)
Now, to get this working also on iOS...


therevills(Posted 2014) [#54]
Glad its working for you guys ... It'll need updating soon (with the new Admob), but for now if you can forward your ad revenue to my paypal account that will be great ;)

Now, to get this working also on iOS...

erebel55 did some work on this a couple of months ago:
http://www.monkey-x.com/Community/posts.php?topic=8235&page=1


therevills(Posted 2014) [#55]
I've just edited the first page and added the updated java code which is needed to get these to work on the new Android target.


silentshark(Posted 2014) [#56]
Just looking at this.. what's the difference between the "old" and "new" android targets on the first page?

(big thank you btw for therevills for pulling htis stuff together)


therevills(Posted 2014) [#57]
what's the difference between the "old" and "new" android targets on the first page?


Due to the deprecation of the standalone AdMob SDK which the "old" Android target is using, Mark has added a "new" Android target in MonkeyX version v79d which supports the new AdMob SDK but only runs on Android 2.3.3 (Gingerbread).

Currently you can select both targets within an IDE, so I left the old version of the AdMob code and added the new one :)


silentshark(Posted 2014) [#58]
Ah, that makes sense. Cheers for explaining that. I will try installing latest Monkey, latest java/ant etc. and trying this out :-)


silentshark(Posted 2014) [#59]
Sometimes it is depressing just how poor I am at figuring out how to get these things working..

Latest monkey (80a), latest Java/ ant etc. installed by mxdevinstall, latest diddy installed. Using the monkey source in the 1st post of this thread, I get this error when compiling:

BUILD FAILED
C:\monkeydev\android-sdk-windows\tools\ant\build.xml:470: The following error occurred while executing this line:
C:\Users\tom\Dropbox\MonkeyXPro80a\tom\int.buildv80a\android_new\google-play-services_lib\build.xml:55: sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable.

Total time: 0 seconds
TRANS FAILED: Android build failed.
Done.


Oh therevills, guru of all things monkey and diddy, any ideas?


therevills(Posted 2014) [#60]
I've yet to update to v80a, have you got all the Android targets etc setup? Could you try v79d?


silentshark(Posted 2014) [#61]
I can't get 79d, but 79e gives:

BUILD FAILED
C:\monkeydev\android-sdk-windows\tools\ant\build.xml:470: The following error occurred while executing this line:
C:\Users\tom\Desktop\MonkeyXPro79e\tom\int.buildv79e\android_new\google-play-services_lib\build.xml:90: Cannot find d:\devtools\android-sdk-windows\tools\ant\build.xml imported from C:\Users\tom\Desktop\MonkeyXPro79e\tom\int.buildv79e\android_new\google-play-services_lib\build.xml


which i think is the bug you reported?

If I delete the build dir, update the hard-coded value in targets\android_new\template\google-play-services_lib\local.properties (think this was the bug u pointed out), then it compiles fine in 79e


therevills(Posted 2014) [#62]
Yeah I think its an issue with v80, I've let Mark know over in the bug thread:
http://www.monkey-x.com/Community/posts.php?topic=8667


silentshark(Posted 2014) [#63]
Great. Thanks. I will experiment with 79e..


therevills(Posted 2014) [#64]
Mark has released 80b, could you try again when you have time.


slenkar(Posted 2014) [#65]
when I compile it says:
identifier ShowAd not found

this line seems to compile though:
admob = AdmobInterstitial.GetAdmobInterstitial("add unit id")

so I have it set up correctly. It just doesnt recognise that method for some reason


EDIT-
there was a namespace clash

admob was already a global
for some reason it didnt work as a field


Chugs(Posted 2014) [#66]
I know this an old thread to dig up. Having issues with new admob.

When i compile i get this error:
MonkeyGame.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details. <- Whats this?
[javac] 7 errors
[javac] 3 warnings
TRANS FAILED: Android build failed.
Done.


Volker(Posted 2014) [#67]
MonkeyGame.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details. <- Whats this?


You can ignore this messages.
We need to see more of your log to help.


Chugs(Posted 2014) [#68]
Here's the compile list... Could it be that I need to install this 'com.google.android.gms.ads' ?

-compile:
[javac] Compiling 3 source files to C:\MonkeyXPro78h\MyShit\AdTest\AdTest.buildv78h\android\bin\classes
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] C:\MonkeyXPro78h\MyShit\AdTest\AdTest.buildv78h\android\src\com\monkeycoder\monkeygame\MonkeyGame.java:36: error: package com.google.android.gms.ads does not exist
[javac] import com.google.android.gms.ads.*;
[javac] ^
[javac] C:\MonkeyXPro78h\MyShit\AdTest\AdTest.buildv78h\android\src\com\monkeycoder\monkeygame\MonkeyGame.java:2908: error: cannot find symbol
[javac] if (interstitialAd.isLoaded()) {
[javac] ^
[javac] symbol: method isLoaded()
[javac] location: variable interstitialAd of type InterstitialAd
[javac] C:\MonkeyXPro78h\MyShit\AdTest\AdTest.buildv78h\android\src\com\monkeycoder\monkeygame\MonkeyGame.java:2923: error: cannot find symbol
[javac] AdRequest.Builder adRequest = new AdRequest.Builder();
[javac] ^
[javac] symbol: class Builder
[javac] location: class AdRequest
[javac] C:\MonkeyXPro78h\MyShit\AdTest\AdTest.buildv78h\android\src\com\monkeycoder\monkeygame\MonkeyGame.java:2923: error: cannot find symbol
[javac] AdRequest.Builder adRequest = new AdRequest.Builder();
[javac] ^
[javac] symbol: class Builder
[javac] location: class AdRequest
[javac] C:\MonkeyXPro78h\MyShit\AdTest\AdTest.buildv78h\android\src\com\monkeycoder\monkeygame\MonkeyGame.java:2931: error: no suitable constructor found for InterstitialAd(Activity)
[javac] interstitialAd = new InterstitialAd( activity );
[javac] ^
[javac] constructor InterstitialAd.InterstitialAd(Activity,String) is not applicable
[javac] (actual and formal argument lists differ in length)
[javac] constructor InterstitialAd.InterstitialAd(Activity,String,boolean) is not applicable

[javac] (actual and formal argument lists differ in length)
BUILD FAILED
[javac] C:\MonkeyXPro78h\MyShit\AdTest\AdTest.buildv78h\android\src\com\monkeycoder\monkeygame\MonkeyGame.java:2932: error: cannot find symbol
C:\Program Files\android\android-sdk\tools\ant\build.xml:720: The following error occurred while executing this line:
C:\Program Files\android\android-sdk\tools\ant\build.xml:734: Compile failed; see the compiler error output for details.
[javac] interstitialAd.setAdUnitId(adUnitId);
[javac] ^

Total time: 4 seconds
[javac] symbol: method setAdUnitId(String)
[javac] location: variable interstitialAd of type InterstitialAd
[javac] C:\MonkeyXPro78h\MyShit\AdTest\AdTest.buildv78h\android\src\com\monkeycoder\monkeygame\MonkeyGame.java:2935: error: <anonymous com.monkeycoder.monkeygame.AdmobInterstitial$1> is not abstract and does not override abstract method onLeaveApplication(Ad) in AdListener
[javac] interstitialAd.setAdListener(new AdListener() {
[javac] ^
[javac] Note: C:\MonkeyXPro78h\MyShit\AdTest\AdTest.buildv78h\android\src\com\monkeycoder\monkeygame\MonkeyGame.java uses unchecked or unsafe operations.
[javac] Note: Recompile with -Xlint:unchecked for details.
[javac] 7 errors
[javac] 3 warnings
TRANS FAILED: Android build failed.
Done.

This is from compiling the example code.


Volker(Posted 2014) [#69]
You need at least Monkey V80c.
You need the newest Admob Interstitial module (from page 1 of this thread).
Your need to compile with the Android_Game_(Experimental) target.

I get the same errors when compiling with the Android_Game target.


Chugs(Posted 2014) [#70]
The newest module is already in the diddy frame work yes? I just downloaded it a week ago.If not, that's an easy fix i suppose.

Looks like I gotta get 80c then ...


Chugs(Posted 2014) [#71]
Um... call me a noob but where do I download V80c? When I go to product updates I only see Monkey X 77A


Volker(Posted 2014) [#72]
I see Monkey Pro V81b...


Chugs(Posted 2014) [#73]
Yeah, I don't know what to do. The update I get is lower than the version I have which is 78h. It would appear I can't get it, unless I'm in the wrong place.
I have to assume it's in my account under product updates yes?

** edit **

I'm goob, i forgot to register monkey x pro when i bought it ... now to find my reg code....


Chugs(Posted 2014) [#74]
Ok, got everything working compiling and to run. However, I get nothing but a black screen (no ads) when running the example code. What am I missing?


therevills(Posted 2014) [#75]
Did you create an Interstitial ad within AdMob and change the following line with the ID?
admob = AdmobInterstitial.GetAdmobInterstitial("your Interstitial ad unit id")



Chugs(Posted 2014) [#76]
Oh no I didn't. I just created an account is all. So I have to create an ad to display ads? Ok.

Thanks for the help :)


Volker(Posted 2014) [#77]
So I have to create an ad to display ads?

I can create and ad for your under my account and send you the id :-)


Chugs(Posted 2014) [#78]
I don't actally have to have a published app on Google play to test do I? Can I do a test with out actually linking an app, like use a devict Id with the test emulator?


Volker(Posted 2014) [#79]
No, you don't need a published app.
I don't know if it works in the emulator, it would be better to try it on a real device.


therevills(Posted 2014) [#80]
BTW dont "test" too much or you could ban yourself from AdMobs...


Chugs(Posted 2014) [#81]
Oh ok .... Whew... What a relief I didn't think I should have to, but wasn't sure.
Thanks Volker and therevills. :-)

Yeah, I do everything on my device after compile. I was wondering about changing this line:
#ADMOB_ANDROID_TEST_DEVICE1="TEST_EMULATOR" to the ID of device is all.

Oh, and another thing, Is it possible to change layouts fairly simple like the older BRL module of admob? Or do I have to experiment making different ads on my admob account.

I did create an ad on admob so I'm going to try it again with the ID that was provided ...


Volker(Posted 2014) [#82]
Is it possible to change layouts fairly simple like the older BRL module of admob?

What for? It's fullscreen, so you don't have to care about the layout.
You just have to care WHEN to show it and how often.


Chugs(Posted 2014) [#83]
Ok I thought so. I still don't get anything. I'll try the code in one of my app projects later to see if it will work I guess. :)


Chugs(Posted 2014) [#84]
I did finally get ads.. I had to use an existing published app (which gave me a different ID) I have on Google Play to get the ads work. ;)
I didn't see any other way to do it as the new admob control panel seems to want you to link in an app for the ads.


Volker(Posted 2014) [#85]
Great to hear. Yes, admob is sometimes a bit difficulty, much trial and error. But at least I get ads on all my apps.


slenkar(Posted 2015) [#86]
Its crashing my game now. In took it out and no longer get crashes.
There is nothing on the logcat
The game reboots itself which is unusual,
Usually when there is a crash the game just stops with an error dialogue
But the game just silently crashes and restarts


therevills(Posted 2015) [#87]
Strange and removing the code "fixes" it?

Have you recently upgraded your version of Android?


slenkar(Posted 2015) [#88]
Yes cos I got a new tablet with android kitkat
So its the OS?


Xaron(Posted 2015) [#89]
Same here. Does anyone have a solution already?


therevills(Posted 2015) [#90]
Can you try adding "GET_TASKS" to the manifest.
#ANDROID_MANIFEST_MAIN+="<uses-permission android:name=~qandroid.permission.GET_TASKS~q />"

Which will add:
<uses-permission android:name="android.permission.GET_TASKS" />



Xaron(Posted 2015) [#91]
Well no that did not change anything, still looking into it...

E/AndroidRuntime( 1390): java.lang.IllegalStateException: isLoaded must be called on the main UI thread.


Calling showAd from within OnRender should be the main UI thread, right?


Xaron(Posted 2015) [#92]
My fault: Had to call it in onUpdate not in onRender...

So it works, thanks for your help!


silentshark(Posted 2015) [#93]
@Xaron was there anything more to this error?

I'm getting the exact same problem (same error). It was all fine on 79e, but I've moved onto 85e now, and when I try to do interstitials, it compiles fine, but I get the same run-time crash. I'm calling ShowAD() from within OnUpdate()..

any clues?

Here's my debug log:



Just a thought - this couldn't be anything to do with a change which crept in on v84 of Monkey - "Tweaked android_new target so OnUpdate always happens on render thread.".. could it?


silentshark(Posted 2015) [#94]
Is it bad form to bump?

Is anyone having any joy with Android Admob Interstitials on 85e or above, or is it just me struggling?


jayparker(Posted 2015) [#95]
I don't know if this helps, but I use version 80c and admob interstitial works.


therevills(Posted 2016) [#96]
Been a while since I messed with AdMob and I'm getting the same issue as SilentShark using MonkeyXPro85a... did anyone manage to fix it?


Paul - Taiphoz(Posted 2016) [#97]
What is the issue ?, I'm using then in one of my games that I was planning to patch but cant now if this is broken.


therevills(Posted 2016) [#98]
Due to the change highlighted by SilentShark "Tweaked android_new target so OnUpdate always happens on render thread", the isLoaded now complains about "isLoaded must be called on the main UI thread" even when running it in the OnRender method.

My current work around is to use an older version of the androidgame.java (from v84b), until Mark replies to my bug report:

http://www.monkey-x.com/Community/posts.php?topic=10440


tagoror(Posted 2016) [#99]
Anybody knows if it's possible to download Monkey v84b?

It's not available at product updates page.

Regards,

Javier


Snader(Posted 2016) [#100]
Please delete