$10 eCPM GUARANTEED. Meet RevMob!

Hi guys,

I am still struggling with not allowing people for pressing the play button while the game is waiting for the ad full screen to be displayed (for instance after app resume). I went with krystian6 method (thanks!) I show a waiting screen and close it after 10 sec (timer) I also have a revmob listener to watch for adClosed or adNotReceived to cancel the timer and close the waiting screen and go back to the main menu. My issue is that the revmob listener function is never called!? I have that function as a global function. I tried to put it in the main.lua or in the waitingScreen.lua and at both place the function is not called even so i can see the ad shows, I closed and the terminal shows that the ad was closed. I am completly at lost on why the revmob listener is not called. This with the simulator and on the devices.

Any suggestions?

Thanks so much. I am trying to fix this before I can release my app.

Mo
@krystian6: Thanks again for your help. I was wondering if you were willing to share your global function that close your waiting screen? Thanks in advance. [import]uid: 100814 topic_id: 25797 reply_id: 128903[/import]

@krystian6: I am very curious to see how your app(s) deals with revmob. Can you share one of your app iTunes link here? Or actually anybody who successfully dealt with the issue of revmob ad not coming fast enough and where the player can start a new game.

I am still struggling with the revmob listener that do not seems to get trigger as well?!

THANKS

Mo

@lairdgames [import]uid: 100814 topic_id: 25797 reply_id: 128996[/import]

@LairdGames: sorry, my game is not out yet.

[import]uid: 109453 topic_id: 25797 reply_id: 129015[/import]

Thanks for your reply. Good luck!

Can I ask you a question? It seems that your Revmob listerner is functioning fine. Can you tell me where did you put that function? Main.lua? Other module? For the life of me I cannot figure out why my listerner function is not called. I try to put it both in main.lua and also in different modules but no luck so far. I also made sure it is global function.

Thanks again.

Mo [import]uid: 100814 topic_id: 25797 reply_id: 129027[/import]

In my main.lua file I declare a function, which handles all of the ads.
In my case, it takes only one param - listener.
This listener is used to trigger game logic, which should follow after ad was closed [like for example: start game level].
This is a code sample I took from our code base, just keep in mind it can contain some typos etc. as I was stripping our branding off of it :wink:

-- load ads  
 local showingAd = false  
 MY.showAd = function(listener)  
 if not showingAd then  
 showingAd = true  
 local grp = display.newGroup()  
 local bg = display.newRect(MY.x, MY.y, MY.width, MY.height) -- ad overlay  
 bg:setFillColor(0, 0, 0)  
 bg:addEventListener('touch', function() return true end) -- catch touches on the overlay  
 grp:insert(bg)  
 local txt = display.newText(MY.l('waitForAd'), 0, 0, 'customFont', 18) -- some text to inform user what's going on  
  
 grp:insert(txt)  
  
 txt:setReferencePoint(display.CenterReferencePoint)  
 txt.x = display.contentWidth \* 0.5  
 txt.y = 160  
  
 local function showButton()  
 local xbutton = display.newImageRect("close\_button.png", 30, 30)  
 xbutton.x = MY.x + MY.width - 40  
 xbutton.y = MY.y + 40  
 xbutton:addEventListener("tap", function() showingAd = false grp:removeSelf() if listener then listener() end end)  
 grp:insert(xbutton)  
 end  
  
 local tmr = tnt:newTimer(10000, showButton) -- the value in here has to be greater than rev mob timeout  
  
 local function lstn(e)  
 if e.type == 'adClosed' then  
 showingAd = false  
 tmr:cancel()  
 tmr = nil  
 grp:removeSelf()  
 if listener then listener() end  
 end  
 end  
  
 RevMob.showFullscreen(lstn)  
 return true  
 end  
 return false  
 end  

MY is just our global helper table, with some global functions/variables we use.
This works fine for us [at least during our tests].
Hope this helps. [import]uid: 109453 topic_id: 25797 reply_id: 129040[/import]

@krystian6: I am very curious to see how your app(s) deals with revmob. Can you share one of your app iTunes link here? Or actually anybody who successfully dealt with the issue of revmob ad not coming fast enough and where the player can start a new game.

I am still struggling with the revmob listener that do not seems to get trigger as well?!

THANKS

Mo

@lairdgames [import]uid: 100814 topic_id: 25797 reply_id: 128996[/import]

WOW! I do not know how to thank you enough! I really appreciate you took the time. I will study your code carefully. And yes this really help!

THANK YOU:)

Mo

@Revmob: any ideas why my Revmob listener (ie: adClosed) is not triggered? Do I need to be careful about the location of the listener function (in main.lua) ? Does it need to be set before the start session line? Does it matter? Thanks. [import]uid: 100814 topic_id: 25797 reply_id: 129089[/import]

@LairdGames: I truly doubt there’s something wrong with revmob code, simply because it works for us.

Have you tried doing something like:

RevMob.showFullscreen(function(event) print("I've been called") end)  

? [import]uid: 109453 topic_id: 25797 reply_id: 129091[/import]

@krystian6: yes I agree with you. I am sure I am doing something wrong. I did not know I could do this! I will try your suggestion as soon as I get access to my computer.

Thank you so much. That is why I LOVE this community:)

Mo [import]uid: 100814 topic_id: 25797 reply_id: 129093[/import]

@LairdGames: sorry, my game is not out yet.

[import]uid: 109453 topic_id: 25797 reply_id: 129015[/import]

Thanks for your reply. Good luck!

Can I ask you a question? It seems that your Revmob listerner is functioning fine. Can you tell me where did you put that function? Main.lua? Other module? For the life of me I cannot figure out why my listerner function is not called. I try to put it both in main.lua and also in different modules but no luck so far. I also made sure it is global function.

Thanks again.

Mo [import]uid: 100814 topic_id: 25797 reply_id: 129027[/import]

In my main.lua file I declare a function, which handles all of the ads.
In my case, it takes only one param - listener.
This listener is used to trigger game logic, which should follow after ad was closed [like for example: start game level].
This is a code sample I took from our code base, just keep in mind it can contain some typos etc. as I was stripping our branding off of it :wink:

-- load ads  
 local showingAd = false  
 MY.showAd = function(listener)  
 if not showingAd then  
 showingAd = true  
 local grp = display.newGroup()  
 local bg = display.newRect(MY.x, MY.y, MY.width, MY.height) -- ad overlay  
 bg:setFillColor(0, 0, 0)  
 bg:addEventListener('touch', function() return true end) -- catch touches on the overlay  
 grp:insert(bg)  
 local txt = display.newText(MY.l('waitForAd'), 0, 0, 'customFont', 18) -- some text to inform user what's going on  
  
 grp:insert(txt)  
  
 txt:setReferencePoint(display.CenterReferencePoint)  
 txt.x = display.contentWidth \* 0.5  
 txt.y = 160  
  
 local function showButton()  
 local xbutton = display.newImageRect("close\_button.png", 30, 30)  
 xbutton.x = MY.x + MY.width - 40  
 xbutton.y = MY.y + 40  
 xbutton:addEventListener("tap", function() showingAd = false grp:removeSelf() if listener then listener() end end)  
 grp:insert(xbutton)  
 end  
  
 local tmr = tnt:newTimer(10000, showButton) -- the value in here has to be greater than rev mob timeout  
  
 local function lstn(e)  
 if e.type == 'adClosed' then  
 showingAd = false  
 tmr:cancel()  
 tmr = nil  
 grp:removeSelf()  
 if listener then listener() end  
 end  
 end  
  
 RevMob.showFullscreen(lstn)  
 return true  
 end  
 return false  
 end  

MY is just our global helper table, with some global functions/variables we use.
This works fine for us [at least during our tests].
Hope this helps. [import]uid: 109453 topic_id: 25797 reply_id: 129040[/import]

WOW! I do not know how to thank you enough! I really appreciate you took the time. I will study your code carefully. And yes this really help!

THANK YOU:)

Mo

@Revmob: any ideas why my Revmob listener (ie: adClosed) is not triggered? Do I need to be careful about the location of the listener function (in main.lua) ? Does it need to be set before the start session line? Does it matter? Thanks. [import]uid: 100814 topic_id: 25797 reply_id: 129089[/import]

@LairdGames: I truly doubt there’s something wrong with revmob code, simply because it works for us.

Have you tried doing something like:

RevMob.showFullscreen(function(event) print("I've been called") end)  

? [import]uid: 109453 topic_id: 25797 reply_id: 129091[/import]

@krystian6: yes I agree with you. I am sure I am doing something wrong. I did not know I could do this! I will try your suggestion as soon as I get access to my computer.

Thank you so much. That is why I LOVE this community:)

Mo [import]uid: 100814 topic_id: 25797 reply_id: 129093[/import]

@krystian6: Sorry for the delay. Unfortunately the code you suggested

[lua]RevMob.showFullscreen(function(event) print(“I’ve been called”) end)[/lua]
still did not work. For some reason the listener is never triggered for me. I have also put together the simplest test app (only a small main.lua and remob.lua) and still no go. The bizarre thing is that if i call

RevMob.testFullscreenWeb(revmobListener) The listener is called but not when doing this:

RevMob.showFullscreen(revmobListener)

In both case I can see the ad on the device(s) but in the second case, it does not trigger a message and the closing of the wait screen (something like you did)

I am really at lost (work on this for more than week now) so I have sent bunch of emails today to Revmob ((I hope they will hate me!) and hopefully they can figure out this issue.

Thanks again for your help on this as well. Your code really helped.

Mo [import]uid: 100814 topic_id: 25797 reply_id: 129415[/import]

@krystian6: Sorry for the delay. Unfortunately the code you suggested

[lua]RevMob.showFullscreen(function(event) print(“I’ve been called”) end)[/lua]
still did not work. For some reason the listener is never triggered for me. I have also put together the simplest test app (only a small main.lua and remob.lua) and still no go. The bizarre thing is that if i call

RevMob.testFullscreenWeb(revmobListener) The listener is called but not when doing this:

RevMob.showFullscreen(revmobListener)

In both case I can see the ad on the device(s) but in the second case, it does not trigger a message and the closing of the wait screen (something like you did)

I am really at lost (work on this for more than week now) so I have sent bunch of emails today to Revmob ((I hope they will hate me!) and hopefully they can figure out this issue.

Thanks again for your help on this as well. Your code really helped.

Mo [import]uid: 100814 topic_id: 25797 reply_id: 129415[/import]

@LairdGames:
if you have not fiddled with revmob code, then the code I gave you should work [unless there were some API changes I’m not aware of?].
If line is not shown, you should check if you have logging enabled at all [flushing buffers etc.].
I would start with restoring original version of revmob sdk though. [import]uid: 109453 topic_id: 25797 reply_id: 129646[/import]

@LairdGames:
if you have not fiddled with revmob code, then the code I gave you should work [unless there were some API changes I’m not aware of?].
If line is not shown, you should check if you have logging enabled at all [flushing buffers etc.].
I would start with restoring original version of revmob sdk though. [import]uid: 109453 topic_id: 25797 reply_id: 129646[/import]

@krystian6: Thanks for the info. I am curious about when you say “…logging enabled at all [flushing buffers etc.]…”?

I did not changed revmob.lua (3.4.3) but Revmob team think it is a bug and they are working on it. I am not sure why it works for you in that case. i am going wait for the next version and see.

Thanks so much for all your help.

Mo [import]uid: 100814 topic_id: 25797 reply_id: 129697[/import]