Hi,
I now intend to use probably admob on my mobile game.
I have several questions.
1. First is an issue I encountered. Linking admob to the test environment
I used the following code from
http://giderosmobile.com/tools/admobWhile debugging using the Gideros Player, I received the following error
module 'admob' not found:
2. How to link admob to the game in playstore?
3. The proper procedure for implementation for ads. I should complete everything ahead first. Launch the application in Playstore or AppStore. Then link admob to an account given?
3. What is the real meaning of CPM?
It states that Cost per thousand iMpressions. Does it refers to the money received per 1000 click?
Comments
To build your own specific gideros player with ads plugin or don't debug using player at all.
You can use code like this
if application:getDeviceInfo()=="Android" then
require "ads"
admob = Ads.new("admob")
admob:setKey("your_key")
admob:showAd("smart_banner")
admob:setAlignment("center", "bottom")
end
2. You can link your game with admob in admob interface. I'm not sure that it is necessery, but you can do it.
3. Sry, can't understand what you mean. You don't need to link admob with your game at all. Only if you want.
4. No. It is more like money per 1000 impressions(shows). But not really sure about that.
Based on "your_key"?
I need to
1. complete my development (including admob api and plugin) for the application.
2. launch in playstore (eg. for android)
3. Use admob to tie to application to get the key
4. Then recompile game with key
5. Relaunch in playstore?
Is the procedure correct?
Just put a name-only application on admob, and get the key.
This also applied on any other ad network.
You can link the app on ad network to store later on, it's not necessary though.
require "ads"
admob = Ads.new("admob")
admob:setKey("your_key")
admob:showAd("smart_banner")
admob:setAlignment("center", "bottom")
I tried to find admob SDK but realised that its no longer available as a standalone SDK and required me to download google play services instead.
Updated both the Application and Permissions tag as mentioned in
http://docs.giderosmobile.com/interface/ads
I couldn't find AdsMob.java since Google Play Services is installed instead. Hence, I followed the linking procedure of google play services by importing the library to Eclipse and link my application to the library.
The application had problem launching with the simple ad code as shown above.
And please also post what you have in logcat, so we could see what error you have
admob:showAd("banner") shows nothing(just a bar), would a
admob:hideAd("banner") call crashes the application?
01-15 21:30:36.534: E/VCharge(115): vcharged write
01-15 21:30:46.535: E/VCharge(115): vcharged write
01-15 21:30:56.541: E/VCharge(115): vcharged write
01-15 21:31:06.534: E/VCharge(115): vcharged write
01-15 21:31:16.535: E/VCharge(115): vcharged write
01-15 21:31:26.534: E/VCharge(115): vcharged write
01-15 21:31:36.535: E/VCharge(115): vcharged write
01-15 21:31:46.534: E/VCharge(115): vcharged write
01-15 21:31:56.541: E/VCharge(115): vcharged write
01-15 21:32:06.534: E/VCharge(115): vcharged write
01-15 21:32:10.524: E/AudioMTKHardware(134): setCommonParameters() still have param.size() = 1, remain param = "screen_state=on"
01-15 21:32:16.542: E/VCharge(115): vcharged write
01-15 21:32:16.672: E/(134): AudioCloseDumpPCMFile file== NULL
01-15 21:32:16.672: E/(134): AudioCloseDumpPCMFile file== NULL
01-15 21:32:19.608: E/Trace(6793): error opening trace file: No such file or directory (2)
01-15 21:32:19.729: E/linker(6793): load_library(linker.cpp:759): library "libmaliinstr.so" not found
01-15 21:32:26.541: E/VCharge(115): vcharged write
: E/(): Device disconnected
01-16 22:03:23.946: W/Ads(31087): Invalid unknown request error: [Cannot determine request type. Is your ad unit id correct?]
01-16 22:03:23.955: W/Ads(4547): There was a problem getting an ad response. ErrorCode: 1
I did not applied for an ad unit because I have not decided on the application name yet. I am worried that once I decided on a name and if the name is taken up subsequently, I might have a problem with recompiling and require me to relaunch the game.
Anyway great help guys!
I have done a last min support for Gideros on kickstarter for Win 8 development
Likes: ar2rsawseen
I halted on my game application to focus on my other stuff.
Just came back and got stucked here again.
This time, the logcat gives me this:
04-06 21:43:37.336: E/SMD(282): DCD ON
04-06 21:43:40.336: E/SMD(282): DCD ON
04-06 21:43:40.766: E/art(893): No implementation found for void org.codeaurora.Performance.native_deinit() (tried Java_org_codeaurora_Performance_native_1deinit and Java_org_codeaurora_Performance_native_1deinit__)
04-06 21:43:40.766: E/System(893): Uncaught exception thrown by finalizer
04-06 21:43:40.776: E/System(893): java.lang.UnsatisfiedLinkError: No implementation found for void org.codeaurora.Performance.native_deinit() (tried Java_org_codeaurora_Performance_native_1deinit and Java_org_codeaurora_Performance_native_1deinit__)
04-06 21:43:40.776: E/System(893): at org.codeaurora.Performance.native_deinit(Native Method)
04-06 21:43:40.776: E/System(893): at org.codeaurora.Performance.finalize(Performance.java:97)
04-06 21:43:40.776: E/System(893): at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:190)
04-06 21:43:40.776: E/System(893): at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:173)
04-06 21:43:40.776: E/System(893): at java.lang.Thread.run(Thread.java:818)
04-06 21:43:40.776: E/art(893): No implementation found for void org.codeaurora.Performance.native_deinit() (tried Java_org_codeaurora_Performance_native_1deinit and Java_org_codeaurora_Performance_native_1deinit__)
04-06 21:43:40.776: E/System(893): Uncaught exception thrown by finalizer
04-06 21:43:40.776: E/System(893): java.lang.UnsatisfiedLinkError: No implementation found for void org.codeaurora.Performance.native_deinit() (tried Java_org_codeaurora_Performance_native_1deinit and Java_org_codeaurora_Performance_native_1deinit__)
04-06 21:43:40.776: E/System(893): at org.codeaurora.Performance.native_deinit(Native Method)
04-06 21:43:40.776: E/System(893): at org.codeaurora.Performance.finalize(Performance.java:97)
04-06 21:43:40.776: E/System(893): at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:190)
04-06 21:43:40.776: E/System(893): at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:173)
04-06 21:43:40.776: E/System(893): at java.lang.Thread.run(Thread.java:818)
I have re-exported the project.
Anyways, just for clarifications, I'll post some snippet of code here:
AdmobController.lua
require "ads"
AdmobController = gideros.class(BaseSprite)
function AdmobController:init()
self.bAdisUp = false
end
function AdmobController:showAd()
if application:getDeviceInfo()=="Android" then
self.admob = Ads.new("admob")
self.admob:setKey("ca-app-pub-XXXXXXXXX/XXXXXXXXXX")
self.admob:enableTesting()
self.admob:showAd("banner")
self.admob:setAlignment("center", "top")
end
end
function AdmobController:hideAd()
if application:getDeviceInfo()=="Android" then
end
end
function AdmobController:onAddedtoStage(event)
self.admob:addEventListener(Event.AD_RECEIVED, function(e)
print("ads AD_RECEIVED", e.type)
end)
self.admob:addEventListener(Event.AD_FAILED, function(e)
print("ads AD_FAILED", e.type, e.error)
end)
self.admob:addEventListener(Event.AD_ACTION_BEGIN, function(e)
print("ads AD_ACTION_BEGIN", e.type)
end)
self.admob:addEventListener(Event.AD_ACTION_END, function(e)
print("ads AD_ACTION_END", e.type)
end)
self.admob:addEventListener(Event.AD_DISPLAYED, function(e)
print("ads AD_DISPLAYED", e.type)
end)
self.admob:addEventListener(Event.AD_DISMISSED, function(e)
print("ads AD_DISMISSED", e.type)
end)
self.admob:addEventListener(Event.AD_ERROR, function(e)
print("ads AD_ERROR", e.error)
end)
end
function AdmobController:onRemovedFromStage(event)
end
GameScene.lua
function GameScene:init()
self.admobControl = AdmobController.new()
end
function GameScene:onAddedtoStage(event)
self.addChild(self.admobControl)
if (self.randomchance == 5) then
self.admobControl:showAd()
end
end
But the lua code you posted seems legit
Can I try to test this on Gideros player?
Or only able to test this on specific platforms. Eg. Eclipse.
require "ads" cannot be found in gideros even if I build Gideros from scratch
04-07 14:50:59.287: E/libEGL(14357): call to OpenGL ES API with no current context (logged once per thread)
04-07 14:51:00.400: E/VCharge(119): vcharged write
04-07 14:51:01.570: E/(139): AudioCloseDumpPCMFile file== NULL
04-07 14:51:01.570: E/(139): AudioCloseDumpPCMFile file== NULL
Now I get a verbose
04-07 17:34:52.442: D/Gideros(31017): /Users/xxx/Documents/XXXXX/XXXX/assets/assets/scripts/gameScene/admobController.lua.jet:1: module 'ads' not found:
04-07 17:34:52.442: D/Gideros(31017): no field package.preload['ads']
04-07 17:34:52.442: D/Gideros(31017): no file './ads.lua'
04-07 17:34:52.442: D/Gideros(31017): no file '/usr/local/share/lua/5.1/ads.lua'
04-07 17:34:52.442: D/Gideros(31017): no file '/usr/local/share/lua/5.1/ads/init.lua'
04-07 17:34:52.442: D/Gideros(31017): no file '/usr/local/lib/lua/5.1/ads.lua'
04-07 17:34:52.442: D/Gideros(31017): no file '/usr/local/lib/lua/5.1/ads/init.lua'
I have the libads.so files in armeabi, armeabi-7v, x86
I have edited the manifest file to include google play
I have edited my mainActivity.java to include
System.loadLibrary("ads");
"com.giderosmobile.android.plugins.ads.Ads",
I have included the files
com.giderosmobile.android.plugins.ads
com.giderosmobile.android.plugins.ads.framework
What did I missed?
It is really hard to say, but back tracing it like:
If lua can't see plugin, it means either libads.so file is not present or is incorrect (like using armeabi binary for x86, or something like that)
and in the same case, as you say, you have included System.loadLibrary("ads"); then it would give Unsatisfied link error if it could not find libads.so
So either you included System.loadLibrary("ads"); in the wrong place and app does not look for it, or it finds it, but lua can't use it, because it is for incorrect platform or damaged.
Unfortunately thats all I can deduct from the info I have
Let me close this thread!
Thanks ar2rsawseen
glad it was resolved