inMobi close - switching scenes

Using inMobi, I need users to go to other composer scenes.

How do I trigger another ad?

If I go back to my main scene, inMobi doesn’t seem to trigger, because it was already initialised?

So, is there a way to close() inMobi and start a new session?

Related issue: If I have a banner and I want to do an interstitial, do I (can I) close() the inMobi session?

  1. It is a little hard to understand your post.

Did you mean to say,

a. I’m using composer to manage my scenes.

b. I’m using inMobi to show ads ( interstitial?  )

c. I show an ad once (when leaving or entering a scene?)

d. I want to show another one, but I can’t figure out how to show a 2nd,3rd, etc…

2.Did you load a new add after showing the first one?

https://docs.coronalabs.com/daily/plugin/inmobi/index.html

PS - You need to do the load after the video show is complete, not immediately after calling show()

Yes, using composer.

Principally using banners, but want interstitials too

Showing banner ad when I enter the scene. But when I go to another scene (no ad) and then return, the banner ad doesn’t show, and the inMobi init is ignored. So i’m wondering do I stop or clear the ad when leaving a scene?

Or do i call inMobi from main.lua and then can it run (and refresh) over all scenes?

Do I close() inmobi at any stage?

Use paragraphs/blank-lines  for legibility please.  It’s hard to tell where one though/question ends when a post is smooshed together.  

(This is a weakness of mine.  For whatever reason I’m terrible at groking posts that are all one super-paragraph.)

  1. You only call init once.

  2. You can in theory show banners and interstitials from the same provider, but I don’t advise this.  In my experience you can either have a banner loaded and ready to show or an interstitial.  

Trying to have both ready-to-show immediately is troublesome.  (This varies by provider they all have their own peculiarities).

In my usage, if I want a banner and interstitial in my app, I use one provider for the banner and another for the interstitial.

  1. You initialize in main.lua.  You should trigger all of your loads and shows either in the scene event listeners and/or via the ad listener.

  2. No, you do not close inMobi, stop it, shut it down, that isn’t how it works.

  3. Is this your first time using composer.*  If so, you should practice just making basic scenes till you understand the phases, scene changing,etc. thoroughly.

  4. Is this your first time using inMobi?  If so, you should make a simple test bench w/ith ‘buttons’ that trigger, init, load, show.  Then write up a verbose listener that prints out everything that the ad module is doing so you can understand the timing and sequence of things.

  5. Are you an experienced professional (doing this as a job) or are you a new game developer?  

I ask, because I don’t think new developers should be thinking about monetizing their games.  If you are new and don’t do this for the love of it, …  

If you’re a professional, you may want to budget a little bit to get someone to lay out some examples to help you train up on: composer.* as well as  inmobi.* and any other ad providers you want to use.

  1. Stoping/Clearing - You can hide either a banner or an interstitial.  Typically, you only hide banners.  Interstitial are closed by the user/player.

FYI, for the future, I have lots of examples, including samples of composer uses:

One more note, I think you can figure this out on your own, but if not.  I am adding a new feature to SSK2, called ‘ad helpers’.

These aren’t in SSK2 yet, but when I release them they will provide helper functions to simplify complex and event-driven usage of:

  • adMob
  • appLovin
  • house ads (my own WIP unit for local and remotely sourced ‘house’ ads)
  • inMobi
  • mediaBrix
  • revMob
  • Vungle

Final post.  This is a version of the inMobi listener I use in my helper (modified for this post and should be considered WIP  nonetheless it may be useful to you):

-- == -- inMobi Listener -- == local function listener( event ) -- Extract base set of useful event details: local isError = (event.isError == nil) and false or event.isError local phase = (event.phase == nil) and "unknown" or event.phase local eType = (event.type == nil) and "unknown" or event.type local response = (event.name == nil) and "unknown" or event.response print( "inMobi Listener Event @ ", system.getTimer ) print( 'isError: ' .. tostring( isError ) .. '; phase == "' .. tostring(phase) .. '"; response == "' .. tostring(response) .. '"' ) -- Do something with the above details... -- if( isError ) then print( "inMobi is getting errors.") for k,v in pairs( event ) do print( 1, k,v) end else -- Note: There may be more phases. if( phase == "init" ) then elseif( phase == "loaded" ) then elseif( phase == "failed" ) then elseif( phase == "displayed" ) then elseif( phase == "closed" ) then else print( "inMobi is getting a weird event.phase value?! ==\> " .. tostring( event.phase ) ) for k,v in pairs( event ) do print( k,v) end end end end

Thanks for all of that, will review in morning (late here).

The key thing is to put the ad init and function in main.lua, and it runs throughout the composer scenes.

Point take about not running banners and interstitials from the same provider.

  1. It is a little hard to understand your post.

Did you mean to say,

a. I’m using composer to manage my scenes.

b. I’m using inMobi to show ads ( interstitial?  )

c. I show an ad once (when leaving or entering a scene?)

d. I want to show another one, but I can’t figure out how to show a 2nd,3rd, etc…

2.Did you load a new add after showing the first one?

https://docs.coronalabs.com/daily/plugin/inmobi/index.html

PS - You need to do the load after the video show is complete, not immediately after calling show()

Yes, using composer.

Principally using banners, but want interstitials too

Showing banner ad when I enter the scene. But when I go to another scene (no ad) and then return, the banner ad doesn’t show, and the inMobi init is ignored. So i’m wondering do I stop or clear the ad when leaving a scene?

Or do i call inMobi from main.lua and then can it run (and refresh) over all scenes?

Do I close() inmobi at any stage?

Use paragraphs/blank-lines  for legibility please.  It’s hard to tell where one though/question ends when a post is smooshed together.  

(This is a weakness of mine.  For whatever reason I’m terrible at groking posts that are all one super-paragraph.)

  1. You only call init once.

  2. You can in theory show banners and interstitials from the same provider, but I don’t advise this.  In my experience you can either have a banner loaded and ready to show or an interstitial.  

Trying to have both ready-to-show immediately is troublesome.  (This varies by provider they all have their own peculiarities).

In my usage, if I want a banner and interstitial in my app, I use one provider for the banner and another for the interstitial.

  1. You initialize in main.lua.  You should trigger all of your loads and shows either in the scene event listeners and/or via the ad listener.

  2. No, you do not close inMobi, stop it, shut it down, that isn’t how it works.

  3. Is this your first time using composer.*  If so, you should practice just making basic scenes till you understand the phases, scene changing,etc. thoroughly.

  4. Is this your first time using inMobi?  If so, you should make a simple test bench w/ith ‘buttons’ that trigger, init, load, show.  Then write up a verbose listener that prints out everything that the ad module is doing so you can understand the timing and sequence of things.

  5. Are you an experienced professional (doing this as a job) or are you a new game developer?  

I ask, because I don’t think new developers should be thinking about monetizing their games.  If you are new and don’t do this for the love of it, …  

If you’re a professional, you may want to budget a little bit to get someone to lay out some examples to help you train up on: composer.* as well as  inmobi.* and any other ad providers you want to use.

  1. Stoping/Clearing - You can hide either a banner or an interstitial.  Typically, you only hide banners.  Interstitial are closed by the user/player.

FYI, for the future, I have lots of examples, including samples of composer uses:

One more note, I think you can figure this out on your own, but if not.  I am adding a new feature to SSK2, called ‘ad helpers’.

These aren’t in SSK2 yet, but when I release them they will provide helper functions to simplify complex and event-driven usage of:

  • adMob
  • appLovin
  • house ads (my own WIP unit for local and remotely sourced ‘house’ ads)
  • inMobi
  • mediaBrix
  • revMob
  • Vungle

Final post.  This is a version of the inMobi listener I use in my helper (modified for this post and should be considered WIP  nonetheless it may be useful to you):

-- == -- inMobi Listener -- == local function listener( event ) -- Extract base set of useful event details: local isError = (event.isError == nil) and false or event.isError local phase = (event.phase == nil) and "unknown" or event.phase local eType = (event.type == nil) and "unknown" or event.type local response = (event.name == nil) and "unknown" or event.response print( "inMobi Listener Event @ ", system.getTimer ) print( 'isError: ' .. tostring( isError ) .. '; phase == "' .. tostring(phase) .. '"; response == "' .. tostring(response) .. '"' ) -- Do something with the above details... -- if( isError ) then print( "inMobi is getting errors.") for k,v in pairs( event ) do print( 1, k,v) end else -- Note: There may be more phases. if( phase == "init" ) then elseif( phase == "loaded" ) then elseif( phase == "failed" ) then elseif( phase == "displayed" ) then elseif( phase == "closed" ) then else print( "inMobi is getting a weird event.phase value?! ==\> " .. tostring( event.phase ) ) for k,v in pairs( event ) do print( k,v) end end end end

Thanks for all of that, will review in morning (late here).

The key thing is to put the ad init and function in main.lua, and it runs throughout the composer scenes.

Point take about not running banners and interstitials from the same provider.