- This is a known issue even for native Android developers.
For interstitials: Do you call ads.load() to make sure an ad is cached before showing it (also testing with ads.isLoaded())?
For interstitials: Do you call ads.load() to make sure an ad is cached before showing it (also testing with ads.isLoaded())?
I tried to call ads.load(), here are the problems:
(1) ads.load() crashes in Simulator
(2) I still build it for device and ads.load() does not crash in actual device
(3) I can see interstitials ad, but no callback is called in the listener. (which is no good because I need the callback to know if ads is successfully loaded/shown)
(4) And one more biggest problem:
After the first interstitials ad shown, subsequent interstitials ads are not shown.
I think it’s not about working around these admob v2 problems.
V2 has many fundamental problems that Corona should try to test them out & fix them. To make it more reliable. Come on.
ads.load() calls the callback function with an “adsRequest” event name. But you don’t really need to check that because before showing an ad, just call ads.isLoaded(). If it returns true you can safely assume that an ad *will* be shown immediately. If it returns false, fall back to some other ad network.
When you show an admob interstitial, the app suspends (making callbacks nearly pointless), so you just need to call ads.load() again in your app’s onApplicationResume event. There is no such thing as auto caching of interstitials.
v1 works much better and reasonable.
Corona has to identify & document the workarounds you provide if they are the required steps.
But I still think it’s something Corona should improve for V2 as soon as possible. Deadline is coming & iOS submission sometimes requires 2-3 weeks.
We should definitely call ads.load(), check if ad is loaded by calling ads.isLoaded() and then call ads.show()… This is the most reliable way to show v2 interstitials. Docs should be updated to state that explicitly. Calling ads.load() is not an option, its a necessity.
Calling ads.load() is not an option, its a necessity.
Very true. It’s the only reliable way, and it hasn’t failed me yet.
Also calling ads.load() in the app’s onApplicationResume event is important so the app caches the next ad after coming back from an interstitial (or after a prolonged time away from the app).
v1 is not working this way & no document has explained this for v2.
and admob listener is not called even if it fails (or succeeds), why?
everything has changed without formal documentation.
I never used “V1”, so I have no experience with it.
I’d say that the combination of ads.load() and ads.isLoaded() replaces any need for callbacks.
ads.load() means “preload” according to the current doc. As I have said many times, no documentation has mentioned these steps & why it should work in the way you described.
Shouldn’t Corona take these issues formally?
ads.load is not working on ios devices.
xcode console output:
Runtime error: ?:0: attempt to call field ‘load’ (a nil value)
I don’t understand. When I call ads.load() I get a runtime error on simulator and device:
Attempt to call field ‘load’ (a nil value)
Here is the code that throws the error:
ads.load("interstitial", { appId = adUnitID, testMode = false })
I made sure to do a
ads:setCurrentProvider( "admob" )
right before calling ads.load(), but that didn’t help. I’m using the current daily build 2014.2347
Is there any sample code available showing how this is supposed to work?
Yes, i called ads.init(…)
Did you test this functionality on an ios device before releasing it?
I, too, call ads.init() first.
It works fine for me on Android devices. But it crashes with the same error on both iOS devices and the Mac simulator.
Strange.
It works fine for me on iOS devices. iPad mini (iOS7) and iPod Touch 5th gen (iOS8 beta)
@deniz, Stephen
Are you guys sure you’re using this?
settings = { plugins = { ["plugin.google.play.services"] = { publisherId = "com.coronalabs" }, }, }
Yes, I’m sure i’m using the right plugin settings, especially since my code works fine on android devices. I do a platform check to work around the simulator crash so I can build at all, and then it is still crashing on iOS devices ( tested on iPad2 and iPhone 5).
It’s very strange that it works for you. I am also init-ing other ad networks, such as vungle and iads. I wonder if there is some combination of other plugins deniz and I are using that is breaking the admob plugin?
It is strange. One other difference is that I’m using Enterprise, so I’m building locally with my own Xcode project.
I’m using Vungle also (which uses the ads API), but I always make sure I call ads:setCurrentProvider(“admob”) before testing for and showing Admob ads, but I see you’re doing that as well.
I’m stumped :(.
(1) ads.load() crashes in Simulator, that’s for sure (Corona didn’t test this?)
(2) ads.load() didn’t crash in my iOS devices, which is inconsistent with Stephen’s case.
(3) I have mentioned several times, Corona should provide formal documentation for V2 usage. Why ads.load() is required and why there is no more callback in listeners.
(4) Corona should do more proactive testing on V2. V2 seems very unreliable. The deadline is coming and I don’t know what else is more important to maintain this income stream for us developers.
I never use the Simulator to test advertising. Also my proprietary ad module disables all ad-networks when run in the Simulator, which explains why I’ve never seen a crash.
I can’t speak for Admob V2 banners as I rarely use banners nowadays, but V2 interstitials have been reliable, at least for me.