How to create admob ads in Monkey - guide
Monkey Targets Forums/Android/How to create admob ads in Monkey - guide
| ||
First of all I would like to thank Bladum for his help in the below post http://www.monkeycoder.co.nz/Community/posts.php?topic=1091& Second, I want to say that this isn't perfect and displays AdMob ads at the bottom of of a portrait screen only. Looks good in a 320*480 resolution. This is untested on other devices. I will post up landscape screen code when I have some time. This is tested on v42b of Monkey. I will confirm v43 later. I advise you to take a copy of all files before editing them You will need an Admob ad unit, at www.Admob.com ![]() Steps: First you need to edit the Monkey\targets\android\templates\res\layout\main.xml file <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <view class="${APP_PACKAGE}.MonkeyGame$MonkeyView" android:id="@+id/monkeyview" android:keepScreenOn="true" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <com.google.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="50px" android:layout_alignParentBottom="true" ads:loadAdOnCreate="true" ads:adUnitId="YOUR_AD_ID" ads:adSize="BANNER" /> </RelativeLayout> Please note: YOUR_AD_ID is the id of your ad on Admob. Second you need to edit you Monkey\targets\android\templates\AndroidManifest.xml file <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="${APP_PACKAGE}" android:versionCode="1" android:versionName="1.0"> <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="7" /> <application android:label="${APP_LABEL}" android:icon="@drawable/icon"> <activity android:name="MonkeyGame" android:label="${APP_LABEL}" android:screenOrientation="${SCREEN_ORIENTATION}" android:configChanges="keyboardHidden|orientation" android:theme=\"@...; <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation"/> </application> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> </manifest> =UPDATE= Third step not required. Kept here for history purposes. gogot step 4 Thirdly, (I think) you need to edit your Monkey\targets\android\res\values\strings.xml file <?xml version="1.0" encoding="utf-8"?> <resources> <declare-styleable name="com.google.ads.AdView"> <attr name="adSize"> <enum name="BANNER" value="1"/> <enum name="IAB_MRECT" value="2"/> <enum value="3" name="IAB_BANNER"/> <enum value="4" name="IAB_LEADERBOARD"/> </attr> <attr name="adUnitId" format="string"/> <attr format="string" name="loadAdOnCreate"/> </declare-styleable> </resources> 4 - Next you need to upload GoogleAdMobAdsSdk-4.1.0.jar to the Monkey\targets\android\libs folder. (4.1.0 lib works, try not to use versions above this) This file is available from the admob site when you create an app ad. That should be it... Delete the android folder in your {project}.build dir, and recompile your app. If you have an internet connection on your device the ad should appear at the bottom. UPDATE:The first ad may take 2 mins to generate If you need to work out where the bottom of the screen is.. your new height is screeny_ratio = DeviceHeight()/your_game_height new_height = DeviceHieght() - (50/screeny_ratio) comments welcome |
| ||
Thanks for this Rich, it will be most useful :) |
| ||
please note there has been an update to some of the above code... (50px instead of 48px) |
| ||
just my few comments, please feel free to update guide based on this: 1) if this line exist in android manifest xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads then we dont need to setup variables in strings.xml due to fact those variables are defined in ads library (do not add this file at all) 2) use only latest 4.1.0 libs, ive been working and 4.0.4 and there are not working same way (add are not displayed at all) 3) this way is compatible with diddy engine 4) no need to add any java code, just XML addon in menu.xml 5) it is wise to change screen parameters, this is at least my code This work best with porttait if landscape is used then change Width SCREEN_WIDTH = w SCREEN_HEIGHT = h SCREEN_WIDTH_2 = SCREEN_WIDTH / 2 SCREEN_HEIGHT_2 = SCREEN_HEIGHT / 2 DEVICE_WIDTH = DeviceWidth() DEVICE_HEIGHT = DeviceHeight() - 50 SCREENX_RATIO = DEVICE_WIDTH/SCREEN_WIDTH SCREENY_RATIO = DEVICE_HEIGHT/SCREEN_HEIGHT 6) its working with monkey 43 |
| ||
many thanks for confirming... I'll update the guide |
| ||
it would be cool to add "ads" verticaly while game runs horizontalyxxxxxxxxxxxxxxxxxxxxxxxxxx x x A x x x D x x x V x x x E x x x R x x x T x xxxxxxxxxxxxxxxxxxxxxxxxxx |
| ||
it looks like they don't do vertical ads https://www.google.com/adsense/static/en_GB/AdFormats_mobile.html doesn't stop adding them in bottom corner though. Not really a solution is screen area is out of ratio and wierd L shape ============================ = = = = = = = = = = = ============ = = ADVERT = ============================ |
| ||
Oh nice guide, come here to ask if we could put ads in and well here you are. Thanks Pants. |
| ||
I was thinking to make portrait game (from android point of view) then to cheat a bit in monkey engine (switch X and Y) and prepare all graphics rotated 90 degrees this is very brutal workaround to this problem |
| ||
all my games are designed that way... the only problem is that the ads are on their side when horizontal and doesn't look professional. What would be nice is some java code (and monkey functions) to slide that view up and down out of the way. (or to position it anywhere) |
| ||
Friends, Romans and Developers... lend me an ear I've gone and lost GoogleAdMobAdsSdk-4.1.0.jar even though i said not to use any other version ;-) I can only find GoogleAdMobAdsSdk-4.1.1.jar on tinternet. Does anyone have a copy they can send to me? |
| ||
To whom it may concern, I was able to use the latest version of Admob ( GoogleAdMobAdsSdk-4.1.1.jar ) with no problems. |
| ||
I cannot get this to work? I've even tried adding: android:backgroundColor="#FFFFFF" to see if I can spy a box where it should be, and there's nowt!?! Using Monkey Pro V45(c), GoogleAdMobAdsSdk-4.1.1.jar and Diddy Followed the steps about 6 times in case I've missed anything and not a dicky bird! Main.XML <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <view class="${APP_PACKAGE}.MonkeyGame$MonkeyView" android:id="@+id/monkeyview" android:keepScreenOn="true" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <com.google.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="50px" android:backgroundColor="#FFFFFF" android:layout_alignParentBottom="true" ads:loadAdOnCreate="true" ads:adUnitId="a14e6c73d46d51e" ads:adSize="BANNER" /> </RelativeLayout> AndroidManifest.XML <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="${APP_PACKAGE}" android:versionCode="1" android:versionName="1.0" android:installLocation="auto"> <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="7" /> <uses-feature android:glEsVersion="0x00010001" /> <application android:label="${APP_LABEL}" android:icon="@drawable/icon"> <activity android:name="MonkeyGame" android:label="${APP_LABEL}" android:screenOrientation="${SCREEN_ORIENTATION}" android:configChanges="keyboardHidden|orientation" android:theme=\"@...; <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation"/> </application> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> </manifest> Also, if I copy and paste the xml in the guide straight to the respected files, I receive this error:- [Fatal Error] :15:18: Open quote is expected for attribute "{1}" associated with an element type "android:theme". Dabz |
| ||
Something is obviously happening as i've had 5 requests on the admobs site thingy! :D EDIT: On 8 now!?! Dabz |
| ||
The only thing i can maybe see is that the CODE sections on monkeycoder like adding extra \ symbols to lines... check you android theme line and make sure there are no \ symbols after the = symbol and " symbol I think the forum likes making " symbols safe by making them \" |
| ||
Well, I shifted them... Copied an pasted the XML from the guide, built.. Ran... Waited for a bit... 'Requests' incremented by 1, so something is happening... My requests are 31, and impressions are 20. Yet, I cannot see a bloody thing on me phone! Dabz |
| ||
So it doesn't crash anymore? I lost ads on my phone the other day.... Maybe a monkey thing.. not sure. They work in the Android simulator. I did seem to coincide when I upgrade the firmware on my phone, from 2.1 to 2.2 (cyanogenmod) Again all counters increment. What Android version are you running? |
| ||
No, it actually never crashed when I entered the xml manually, it was only when I copied and pasted from the code boxes, then built it that it give me the finger (Which is why I mentioned it at the end in the post above)! :) Erm, Android 2.2 I've created house ads in the vain hope they'll pop through, but, they dont. I've used GoogleAdMobAdsSdk-4.1.1.jar, as well as downloading and replacing that one with GoogleAdMobAdsSdk-4.1.0.jar I've tried running it though a basic monkey app... Only thing left to ask is what version of monkey are you using, if its the newest, then it looks like its royally screwed on my end for whatever unknown reason. EDIT: Just spied the version in the top post... Will give that a whirl Dabz |
| ||
Oh, and I appreciate the help on this... I've tried full paid apps on iOS, and it would be nice to see how the ad model works with something else! :) Dabz |
| ||
maybe its HTC Desire. my firmware is based on the HTC Desire phone (even though I'm running it on my Sony X8) Anyone else with HTC or HTC Desire got this working? |
| ||
*cough* http://www.monkeycoder.co.nz/Community/post.php?topic=1246&post=14785 \o/ Looks like my ads are iOS only!!! :D Even though we never figured it out what the hell went wrong in Android, I'm pretty pleased I've got it grafting on at least one mobile platform! Again, thanks for your help pantson, and thanks for including an iOS guide too... Your a good'un! ;) Dabz |
| ||
Hi everyone. pantson, I've just tried this on my HTC desire (doing the guide in the first post, ignoring step 3) and I am not seeing any ad window even with having the app run for 3-4 minutes. I am using version 4.1.1 because I couldn't find the older version. Edit: However, the requests are appearing on the admob site! |
| ||
Bladum, you posted the below : SCREEN_WIDTH = w SCREEN_HEIGHT = h SCREEN_WIDTH_2 = SCREEN_WIDTH / 2 SCREEN_HEIGHT_2 = SCREEN_HEIGHT / 2 DEVICE_WIDTH = DeviceWidth() DEVICE_HEIGHT = DeviceHeight() - 50 SCREENX_RATIO = DEVICE_WIDTH/SCREEN_WIDTH SCREENY_RATIO = DEVICE_HEIGHT/SCREEN_HEIGHT In what way does this affect or have an impact on the Admob code / changes to the XML files? I am beginning to think that the main "monkeyview" is just pushing the ad view off the bottom of the screen. Thanks |
| ||
Somethings going on here! I'm trying to figure out landscape mode and for a while the ads were showing towards the top left of the screen, but they've now gone again... |
| ||
raz.. I'm thinking that the code doesn;t work on HTCs. why? I don't know. I don't know enough about Android to know if that is the case. I have a Sony X8 with an HTC firmware. Before the firmware upgrade, ads worked on my device. After the ads didn't work. The same code works fine on a friends Samsung. The code that bladum posted doesn't affect anything. Its just some quick constant variables showing that the screen height is now 50 pixels left (due to the Ad) Has anyone else with an HTC tried this? All my landscape games are rotated within Monkey (and not via the android manifest file) Why? I just like it that way. It also means that ads are always in the same location (bottom of the portrait screen) |
| ||
It's very odd that very briefly the ad was showing but about 5 pixels down and right from the top left hand corner (I then of course changed the settings, the ads disappeared and now I can't get them back!). The stats suggest that the advert is appearing, but for whatever reason it's just not showing on screen (maybe it's off screen, maybe it's behind the monkey view?). I'm going to try installing Eclipse and what not tonight and see if I can get a test app to show the adverts as expected and then hopefully translate that to Monkey. I'll let everyone know how I get on. |
| ||
one way to see if it monkey is in the way is to change the main.xml so that monkey is forced to a smaller play area You would have to do this in the templates/res/layout folder in the build dir and then re build. <view class="${APP_PACKAGE}.MonkeyGame$MonkeyView" android:id="@+id/monkeyview" android:keepScreenOn="true" android:layout_width="120px" android:layout_height="160px" /> |
| ||
Thanks Rich, I did actually try that, but it just caused a blank screen every time I tried. I think I'll have to mess around more at the weekend |
| ||
I just tried it with Monkey 47c and the latest Android SDK + latest Admob 4.3.1. I see the banner space BUT I get the following error message there: You must have AdActivity declared in AndroidManifest.xml with configChanges. Any ideas? Google gives exactly ONE result in some strange language. :D edit: Oh and I HAVE declared AdActivity in my Manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="${APP_PACKAGE}" android:versionCode="1" android:versionName="1.0"> android:installLocation="auto"> <supports-screens android:resizeable="false" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:anyDensity="true" /> <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="7" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-feature android:glEsVersion="0x00010001" /> <application android:label="${APP_LABEL}" android:icon="@drawable/icon"> <activity android:name="MonkeyGame" android:label="${APP_LABEL}" android:screenOrientation="${SCREEN_ORIENTATION}" android:configChanges="keyboardHidden|orientation" android:theme=\"@...; <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation"/> </application> </manifest> |
| ||
honestly.. don't know at the mo. Not played with v47 yet. I may have a look tonight. |
| ||
Thanks! Have you had a chance to look at this issue yet? :) |
| ||
sorry, been away on holiday with the family. I'll have a look tonight. |
| ||
No need to apologize! I really appreciate your efforts! :) |
| ||
have you tried turning the \" into " on that blue line? |
| ||
This blue line seems to be a bug of this forum. In the original manifest it isn't there. |
| ||
just to let you know. I have the same issue after upgrading to v47 (taken 2 hours to upgrade my laptop to v47 phew) |
| ||
OK fixed.. after reading the API docs here http://code.google.com/mobile/ads/docs/android/fundamentals.html#requirements There are more items for the manifest XML <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> |
| ||
Thanks Rich, I added that but now I don't see anything at all... Will have a deeper look what's going wrong here. edit: Looks like the same issue raz had. I have a HTC Desire HD... edit2: Google Nexus has the same non visibility. Just to make sure, here's my simple test code, nothing fancy's going on here: Could someone who has AdMob please test this code with Monkey 47 and latest Google SDK? THANKS! Strict Import mojo Global adtestApp:AdTest Function Main:Int() adtestApp = New AdTest() Return 0 End Function Class AdTest Extends App Method OnCreate:Int() SetUpdateRate(30) Return 0 End Method Method OnUpdate:Int() Return 0 End Method Method OnSuspend:Int() Return 0 End Method Method OnResume:Int() Return 0 End Method Method OnRender:Int() PushMatrix() Cls() DrawText( "Hello World", 10, 10 ) PopMatrix() Return 0 End Method End Class My main.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <view class="${APP_PACKAGE}.MonkeyGame$MonkeyView" android:id="@+id/monkeyview" android:keepScreenOn="true" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <com.google.ads.AdView android:id="@+id/adView" android:layout_width="wrap_content" android:layout_height="50px" android:layout_alignParentBottom="true" ads:loadAdOnCreate="true" ads:adUnitId="a14************" ads:adSize="BANNER" /> </RelativeLayout> My AndoidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="${APP_PACKAGE}" android:versionCode="1" android:versionName="1.0" android:installLocation="auto"> <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="7" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-feature android:glEsVersion="0x00010001" /> <application android:label="${APP_LABEL}" android:icon="@drawable/icon"> <activity android:name="MonkeyGame" android:label="${APP_LABEL}" android:screenOrientation="${SCREEN_ORIENTATION}" android:configChanges="keyboardHidden|orientation" android:theme=\"@...; <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> </application> </manifest> |
| ||
just comparing code now |
| ||
Thanks Rich! Maybe you could just send me a simple test app (apk file) where it works? Just to check if it's on my phone's side... |
| ||
I hate to say this.. but your code works for me.![]() This is what I did.. 1) Created a new project.. 2) copied your monkey code 3) compiled the code (no ads working here) 4) copied over the the manifest file and main layout xml file with your settings 5) Make sure GoogleAdMobAdsSdk-4.3.1.jar is in the .build/android/libs folder 6) recompiled and ran in the emulator I also made sure the blue line in the androidmanifest file read " and not \" |
| ||
working APK http://www.mediafire.com/?ccbsk70c8lxuhre |
| ||
Thanks will check that in the emulator. Your apk doesn't show a banner on my device... I don't have any ad blockers installed but my device is rooted and has a custom ROM (2.3.5) |
| ||
Hmm... I exactly tried the same and looked if GoogleAdMobAdsSdk-4.3.1.jar is in the .build/android/libs folder. And it is. But no banner in the emulator nor in the real device. This is totally strange. I see no banner with your apk as well... |
| ||
i have too a custom rom installed on my X8 (HTC 2.2) and I can't see any ads on that. no errors just blank. So it may be the custom roms that have issues. I do get them in my emulator though. |
| ||
Hmm ok. On the Google Nexus I have access, there are no ads as well - and no custom ROM there. I had this error message from above without the configChanges so the banner space IS there. I don't see any banner in the emulator though, no matter if I choose Android 2.1 or 2.2. I'll continue to track this down, thanks for your help! :) BTW: What's the difference between <RelativeLayout /> and <LinearLayout /> in the main.xml? I ask because the docs refer to LinearLayout where you use RelativeLayout. |
| ||
HA! I think I've nailed it down! The main problem seems to be the resolution. Usually I use 480x800 for testing even with the emulator. Now that looks like: ![]() NOW, if I remove the following lines from the manifest: <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="7" /> It looks like: ![]() Voila, there is the add, but the resolution looks scaled. Next I tried to set up an emulator with 320x480 instead of 480x800 and now everything is perfect: ![]() It seems that we miss something here. This should explain why you see the ad on your device (which has 320x480 obviously) but I don't as it has a resolution of 480x800. |
| ||
Ok, finally got it: In main.xml REPLACE: android:layout_height="50px" with: android:layout_height="wrap_content" and it works. :) With 480x800 it looks like: ![]() with 320x480 it looks like: ![]() |
| ||
nice work... Will try the wrap_content on my device. |
| ||
still doesn't work on my X8 :-( The joys of Android and the many devices. Its like the old days of PC dev with the huge amount hardware out there. At least iOS is like the old days of Amiga. If it works on one, it works on them all. |
| ||
Yep. Doesn't work on my Desire HD either, but at least I see it on the emulator now for all resolutions... Phew. Will check this! |
| ||
I just checked other games and yes, I don't see any of them on my Desire HD. Obviously there is an ad blocker in my custom ROM. I'll try it on other devices, there are plenty of them in my company. :) |
| ||
Uhm... has anyone a solution for higher resolution like 480x800?![]() As you can see the banner is scaled up as well, but I want it to have the original size of 320x50. Setting these values in the width and height doesn't work. |
| ||
i think thats up to Google... or you can change ads:adSize="BANNER" /> in the main.xml on higher res downloads |
| ||
I've asked Admob support about this: http://groups.google.com/group/google-admob-ads-sdk/t/3942e3ffa5f90b97 It seems that it works as intended so the banner will scale so that it always fit to the device. |
| ||
there are other banner sizes you can set for higher res versions.. http://code.google.com/mobile/ads/docs/android/intermediate.html 320x50 Standard banner Phones and Tablets BANNER 300x250 IAB Medium Rectangle Tablets IAB_MRECT 468x60 IAB Full-Size Banner Tablets IAB_BANNER 728x90 IAB Leaderboard Tablets IAB_LEADERBOARD |
| ||
Just to let you know, I got it working on my phone as well! :) The problem was an ad blocker. I have a custom ROM and it was included in the ROM (at least the host block list was there). So I downloaded and installed AdFree from the market and clicked on Revert to restore the original Host list. After that, ads where visible on my device. Yay! |
| ||
hooray, I can see ads too now. many thanks. |
| ||
One question: is there a way to control when to enable and disable the ads? Amazing Guide by the way. Thanks |
| ||
there is an api from google so that Ads can be called from the code. I've also been looking at a module for this but with no luck yet. |
| ||
i keep getting this error does anyone know offhand what it means Fatal Error] :5:6: The processing instruction target matching "[xX][mM][lL]" is not allowed. i got it sort of working once where the banner was just a blank space then i messed up. |
| ||
ok fixed that part it was because i had whitespace at the beginning of the androidmanifest.xml file.Now i have you must have ad activity declared in androidmanifest,xml with configchanges Nearly there. |
| ||
have you got this working yet? what issues are you seeing? |
| ||
not yet but ive not done anything on it since my last post as i had a few beers on saturday im starting back on it now trying to work through the above examples. i do have a couple of questions concerning the admod settings just to make sure im doing everything right on that side though. if in my config.txt the APP_LABEL=MonkeyGame and APP_PACKAGE=com.monkey Then in the admob settings is this correct App name:MonkeyGame Android Package =http://com.monkey URL: i just want to make sure im not messing up on that side |
| ||
i think ive got further now but i keep getting this BUILD SUCCESSFUL Total time: 10 seconds * daemon not running. starting it now on port 5037 * * daemon started successfully * Starting: Intent { cmp=com.monkeyx/.MonkeyGame } Process ended with return code 0 at 11/27/2011 6:45:56 PM any ideas what it means please |
| ||
i cant get past this error the program runs fine but no adverts and i dont get any requests for one in the settings on admob. Starting: Intent { cmp=com.monkey/.MonkeyGame } Process ended with return code 0 at 11/27/2011 6:45:56 PM i really dont know what it is and its driving me mad.Has anyone else had this error.Any help would be greatly appreciated. |
| ||
Hi Dave don't think we need to worry about Starting: Intent { cmp=com.monkey/.MonkeyGame } Process ended with return code 0 at 11/27/2011 6:45:56 PM This is just trying to run the app on your device automatically. I has nothing to do with compiling or code in your app. I think we need to concentrate on this APP_LABEL=MonkeyGame and APP_PACKAGE=com.monkey Then in the admob settings is this correct App name:MonkeyGame The app name in admob can be anything you like.. its doesn't have to be the same as your appname in Android. Just make sure you have ANDROID selected as the engine. Quick check... - Create Admob unit on admob site - make sure you have the Google Ads lib in your libs folder - Make sure your Ad unit ID is in your main.xml file - makes sure your admob activity is defined in your manifest file - recompile in Monkey |
| ||
YESSSSSSSS that was what i was missing out.I wasnt putting my Ad unit Id into my main.xml file.Once i added that everything worked.Thank you very much for this and for the tutorial.Today ADMOB tomorrow the world :) |
| ||
glad its now working |
| ||
Hi I've now written a module for AdMob http://www.mediafire.com/?tc0zhpictsq8mdv The module also has dummy code for HTML5 I've included a test app and the templates. You still need to manually change the main.xml, android manifest file (see templates folder) and copy the android SDK jar file into the build folder for your project. So what does this module do? Function Main:Int() New AdTest() AdMobInit("a14f0c5d9581fb1") AdMobTop() Return 0 End Function places the as at the top of the screen or.. Function Main:Int() New AdTest() AdMobInit("a14f0c5d9581fb1") AdMobBottom() Return 0 End Function places the ad at the bottom of the screen It will also decide if you need the larger ad LEADERBOARD for tablets or the smaller BANNER ad for mobile devices and Initiate the correct ad replace "a14f0c5d9581fb1" with your AD_UNIT_ID would be nice if someone could take this module and expand it out for iOS |
| ||
Wow, that's great. Is there a way to turn it off and on? |
| ||
It can now...Method OnUpdate:Int() If MouseHit(MOUSE_LEFT) If show=1 AdMobHide() Else AdMobShow() End show=1-show End Return True End Method upload updated http://www.mediafire.com/?tc0zhpictsq8mdv |
| ||
Thanks. Is there a license for using any of this code? |
| ||
nah.. just enjoy and share any updates with the community |
| ||
thanx for this and your excellent tutorials |
| ||
must say that the lib has been tested on V47d (nothing beyond atm) and also works in portrait. (not tested landscape mode) Also the HTML5 does not connect to Admob or display anything, it just allows you to compile in HTML5 without changing code If you are have any other test results please post them here many thanks |
| ||
PS new thread for code project V1.11 now uploaded http://www.monkeycoder.co.nz/Community/posts.php?topic=2185& |