Hi there,
I have a question, I don’t think it is related specifically to Revmob, but this behavior is not happening with vungle for example.
I intend to encapsulate the plugins, in customized “objects”.
If I have understood well lua language there is not exact object instances possible, but tables.
So here is what I noticed via Revmob plugin: My test case is 1 UI with 3 buttons: 1 to load a banner ad, 1 to check that the banner is loaded, 1 to show the banner ad.
If I use the revmob plugin directly in the UI: The test banner ad is loading in the UI no problem.
If I use my customized “object” I understand that I can’t even initialize.
My idea is that it might be due to the listener event for the different event phases… I don’t know exactly why neither how design this though;
here is what I tried:
[lua]
local Cls_Ads_Revmob = {}
function Cls_Ads_Revmob:new( APP_KEY_ID)
o_Cls_Ads_Revmob = {};
setmetatable( o_Cls_Ads_Revmob, self )
self.__index = self
self.revmob = require( “plugin.revmob” )
self.app_key_id = APP_KEY_ID
function revmobListener ( event )
…
end
self.revmob.init( revmobListener, { appId = self.app_key_id } )
return o_Cls_Ads_Revmob
end
– the getter for the status of the banner
function Cls_Ads_Revmob:checkRevmobBannerReady( )
return self.revmob.isLoaded( self.positionBannerID )
end
return Cls_Ads_Revmob
[/lua]
Another version I tried:
[lua]
local Cls_Ads_Revmob = {}
function Cls_Ads_Revmob:revmobListener ( event )
alert = native.showAlert( “Info”, "revmob - event.phase = " … event.phase … " / event.type = " … tostring(event.type) … " / event.response = " … tostring(event.response), { “OK” } )
…
end
function Cls_Ads_Revmob:new( APP_KEY_ID)
o_Cls_Ads_Revmob = {};
setmetatable( o_Cls_Ads_Revmob, self )
self.__index = self
self.revmob = require( “plugin.revmob” )
self.app_key_id = APP_KEY_ID
function local_rvmbodListener ( event )
self:revmobListener( event )
end
self.revmob.init( rvmbodListener, { appId = self.app_key_id } )
return o_Cls_Ads_Revmob
end
– the getter for the status of the banner
function Cls_Ads_Revmob:checkRevmobBannerReady( )
return self.revmob.isLoaded( self.positionBannerID )
end
return Cls_Ads_Revmob
[/lua]
I do never have the alert message in the event listener that is poping…
I’m kind of new to lua I admit, but I have done many “classes” that way with success until this plugin ads.
I have done the same for vungle and it works like a charm. I intend to do the same for personaly and supersonic but if there is glitch in my design then I’d prefer to understand it now please.