Initializing ads without internet connection

I have noticed a behaviour i think is strange, and I would be interested in hearing other people’s takes and experiences regarding the ads-plugin(s) and internet connectivity. 

Specifically, what happens when the app is started without internet connectivity and later gains connectivity, the ads never seem to load.

Consider this scenario, which I tested and played around with, using admob:

  1. I launch my app in airplane mode, i.e. without internet connectivity: the ads.init()-command doesn’t seem to work nor trigger the adlistener at all, my print commands inside it are never triggered. Nor does the following commands like ads.show() and so on, which makes sense.

  2. I then switch airplane mode back off while inside the app (or by suspending, turning airplane off, and resuming, same result) to enable to connectivity, and wait a while in the hopes of the adlistener being able to refresh, but nothing happens to make the ads load. This is whether or not I try to, via a timer, run the ads.init() command again (which gives the warning that they have already been initialized), do nothing, or just run ads.show() again - the ads are never shown when the internet connectivity is back.

  3. The only way to get teh ads is to force quit the app and restart it; suspend and resume does nothing.

As a sidenote, I find it strange that the adlistener doesn’t get triggered from the init() command with an error flag, so we can track the fact that the ads we’re not launched, and keep retrying. However, even that, it seems to no avail if the availalbe ads commands do nothing anyway after an offline init.

It basically seems that you have one shot of initializing the ads, and if that fails, you’re doomed.  I can imagine a scenario when someone for example starts the app on an airplane, and then continues to play it after they have landed, and then never gets the ads until they would force quit and hard reset the app. Obviously, this would be problematic.

Am I missing something here, or what is the best way to combat this - do I have to set up an independent network connection checker to see if it should even initialize the ads? How have you worked with offline ads initialization?

I think a good way to resolve this would be to check for internet connectivity upon start of the app. See the below threads that discuss best practices on connectivity confirmation:

https://forums.coronalabs.com/topic/53956-how-to-detect-if-the-device-internet-connection-is-wifi-or-3g/

https://forums.coronalabs.com/topic/33356-check-for-internet-connection/

This would allow you to

  1. start the app

  2. check for connectivity

     2a) if connectivity is available, call ads.init()

     2b) if connectivity isn’t available, do not call ads.init()

          2ba) check periodically for connectivity

          2bb) if connectivity becomes available, call ads.init()

  1. ads will be shown

I don’t know how feasible this would be in your app logic, but it might be the easiest/easier method than force-closing the app.

I think a good way to resolve this would be to check for internet connectivity upon start of the app. See the below threads that discuss best practices on connectivity confirmation:

https://forums.coronalabs.com/topic/53956-how-to-detect-if-the-device-internet-connection-is-wifi-or-3g/

https://forums.coronalabs.com/topic/33356-check-for-internet-connection/

This would allow you to

  1. start the app

  2. check for connectivity

     2a) if connectivity is available, call ads.init()

     2b) if connectivity isn’t available, do not call ads.init()

          2ba) check periodically for connectivity

          2bb) if connectivity becomes available, call ads.init()

  1. ads will be shown

I don’t know how feasible this would be in your app logic, but it might be the easiest/easier method than force-closing the app.