It looks like you're new here. If you want to get involved, click one of these buttons!
require "myAdMob" require "myLeadBolt" require "myWebView" local function handleEvent(self,event) if self:hitTestPoint(event.x,event.y) then if self.myName == "hideAd" then myAdMob.hideAd() elseif self.myName == "showAd" then myAdMob.showAd() elseif self.myName == "changePos" then myAdMob.changeAdPos(0,math.random(480)) elseif self.myName == "leadBoltInterstitial" then myLeadBolt.loadAd("202260852") elseif self.myName == "leadBoltAppWall" then myWebView.load("<a href="http://ad.leadboltads.net/show_app_wall?section_id=766169778"" rel="nofollow">http://ad.leadboltads.net/show_app_wall?section_id=766169778"</a><img class="emoji" src="https://forum.gideros.rocks/resources/emoji/wink.png" title=";)" alt=";)" height="20" /> end end end local hideAd = TextField.new(myFont,"hideAd") hideAd.myName = "hideAd" stage:addChild(hideAd) local showAd = TextField.new(myFont,"showAd") showAd.myName = "showAd" stage:addChild(showAd) local changePosAd = TextField.new(myFont,"changePos") changePosAd.myName = "changePos" stage:addChild(changePosAd) local leadBoltBanner = TextField.new(myFont,"leadBoltInterstitial") leadBoltBanner.myName = "leadBoltInterstitial" stage:addChild(leadBoltBanner) local leadBoltAppWall = TextField.new(myFont,"leadBoltAppWall") leadBoltAppWall.myName = "leadBoltAppWall" stage:addChild(leadBoltAppWall) for i=1,stage:getNumChildren() do local sprite = stage:getChildAt(i) if sprite.myName ~= nil then sprite:setPosition(0,50+i*50) sprite:addEventListener(Event.MOUSE_DOWN, handleEvent,sprite) end end myAdMob.loadAd("youradmobid")--must be called only once otherwise two or more ads will be there |
Comments
http://www.leadbolt.com/developers_signup.php?ref=10029307
also for app icon ad and notification ad there is no need of plugin
thnx
Likes: Disciple
@hgvyas123 I have one question regarding this plug-in. Did you used google's sdk for Admob or are you calling by a http request like ad-sense? (Admob sdk jar file)
thnx
can anyone share on how to use this plugin? Implementing ads is the last step left before realesing the app. Mostly interested in AdMob.
Some (maybe stupid) questions:
1) Do I need to simply copy some dll to some folder or modify exported android project to implement that?
Because when I view MyAdMob.java, it include calls to ElasticJointsActivity, which relates to ElasticJoints app. So obviously I'll need to rewrite it to match my app. Or there any universal way to do this?
2) To test it, does it work only on exported android project, or it can work in Gideros player too?
Steps I need to do:
1) include Admob SDK into project
2) copy MyAdMob.cpp into jni directory
3) copy libmyAdMob.so into libs directory for both armeabi
4) rewrite MyAdMob.java to match my app's activity and include into src/com/giderosmobile/android
Or is there any better way to do it before exporting app, so it would be done automatically? Or did I miss anything?
Completely confused now. Any help appreaciated.
Dislikes: FrancoisDM
i had not tried it with giderosplayer but it will work.
here's the what i am doing
copy the .so files from libs folder (myAdmob.so and myLeadbolt.so) in ur folders armeabi-v7a and armeabi respectively. do not replace any .so file.
copy jar files and add them to build path
copy java files from src directory
replace ElasticJointsActivity with ur activity or class name in all three java files
some of the changes also needed in ur activity match both and u r ready
no need to take .cpp or .mk file unless u want to add other functions. let me know if it not work.
So if I only save project (without running/compiling app), I then can not check if this project modification (AdMob manipulated lua code) even correctly exported. Because I can't find plain lua files in exported project to check it.
And it's also can be quite a bit stressfull to test it like this, always exporting project.
But I think I got the idea and will try to do it tonight. Only hoped there was a better way.
Still thank you so much for sharing this
Likes: gorkem, ar2rsawseen, jenotscom
Website: http://www.castlegateinteractive.com
https://play.google.com/store/apps/developer?id=Castlegate+Interactive
nice hack
thank you, that'll help
Then I decided to put contents of myAdMob.java methods into try and catch blocks, hoping to see an exception. And all suddenly seemed to start working. Tried to implement it on another bigger project as GameTemplate and even with try catch blocks got occasional crashes (again without specific errors, sometimes it's "Undefined type' ", sometimes simply "VM aborting", sometimes nothing).
Sent same apk to my friend to test, and he told that he couldn't even launch the application no matter how many times he tried.
When I comment out admob usage inside lua (haven't tried other ad networks), everything works fine.
@hgvyas123 have you tested this plugin with latest Android SDK. Latest Gideros SDK. Maybe it's a windows Android SDK related problem? Does everything work fine for you?
yup i had tested this on my device with latest gideros studio and i think so latest android sdk or may be in 4.0.3 (not sure)
also see this thread
http://www.giderosmobile.com/forum/discussion/1506/crash-on-android-java.lang.clonenotsupportedexception-class-doesn039t-implement-cloneable#Item_12
at that time also in my device it is running perfectly but not in other device may be my device is the real smartphone i am guessing that it is related with the android os version installed on device i have icecream. as u can see from the above thread it is giving some strange errors on my friends devices and @scouser had solved that. may be need some more lights on this.
by the way by finding this crash u have saved me from the big issue of github
1. there is no error message in LogCat
2. LogMessages aren't outputted from myAdMob.java (meaning java class is not called at all)
3. If calling admob functions are commented out inside myAdMob.java it still crashes.
Problem persists on Android 2.2 where you can't even start the app (it always crashes) and on Android 2.3 it works almost all of the time, only sometimes crashing.
So problem probably is with calling Java methods using JNI. Did someone managed to do it that it would work on all android versions? That would help a lot.
and @hgvyas123 when it's fixed, you're back to your github issue
just an update, I've been dissecting this plugin bit by bit, trying to reconstruct it from scratch etc (Which will probably turn into a nice Android plugin development tutorial if I manage to get it working correctly ).
And now I almost certainly know what is wrong, just don't know how to fix it.
So for example if we take this c++ function using JNI:
admobtest1
admobtest2
admobtest3
admobtest4
blah blah - 1
blah blah - 2
and it crashes. No exception, nothing. Basically if I don't use runnable (don't try to run anything on UI thread, it all works perfectly, passing values, returning values, etc). So question is, how should I properly run something on UI thread to display admob view? Is there any other way?
For now issue is only with Android 2.2 (never works) and Android 2.3 (sometimes works)
Likes: hgvyas123