Closed calebeaires closed 6 years ago
This should be more than a suggestion, because using the plugin this way is a violation of Admob's policies and as the OP says they will contact you. It is within Admob's rights to withhold your ad money and terminate your account. The issue is that they specifically say you cannot show an interstitial an indeterminate amount of time after the action that triggered it. It will almost never be the case that the interstitial is loaded immediately after it is requested. The way this plugin works at the moment, it will nearly always present the interstitial a few seconds after you call it, and that is exactly what Admob does not allow.
That's clear. Anyone wanting to contribute a solution?
In the README, it says: "Note that Interstitial banners need to be loaded before they can be shown, but don't worry: this plugin will manage that transparently for you", which seems in contradiction to this (open) issue. Can you please clarify if preloading has been added for both platforms and this issue should be closed, or if the above statement is incomplete or inaccurate? Thanks!
It’s accurate AND preloading hasn’t been added but it’s still up for grabs.
What the readme says is you don’t have to call 2 functions (load, then show when loaded) as it’s all integrated into 1 function.
It’s accurate AND preloading hasn’t been added but it’s still up for grabs.
What the readme says is you don’t have to call 2 functions (load, then show when loaded) as it’s all integrated into 1 function.
Can you please provide an example. All I can see is when I use your example on the main readme, it shows the ad as soon as it is loaded. How do I preload the ad and show when needed?
You are using a test ad, so that displays very quickly. But a normal ad will take at least a few seconds to load, and maybe longer depending on the ad content and the device connection. The way to test this properly is to log to the console when the ad is successfully loaded (or not), and then trigger the ad to display based on some action by the user. And this cannot be done with the plugin as it currently is.
So any other alternatives? maybe another plugin? How do you guys solve this problem in your own apps?
Exactly as @SteveOliverC states.
Btw, it's not too hard to add to this plugin, it's just a matter of priority/time.
It's been a while since I solved this so let me see if I can remember exactly .... I hacked each of the iOS and Android codes so that would return a status code rather than display the interstitial. That way my app knew the interstitial was loaded. Then I added a method to show the loaded interstitial. But I could not get this to work again after the first time it was loaded and displayed -- it would never return another status code when requesting another ad load. It was too hard for me to figure out :)
Thanks for the plugin, really appreciate it. But as it stands we shouldn't use the plugin for interstitial ads without first hacking the plugin code?
"Note that Interstitial banners need to be loaded before they can be shown, but don't worry: this plugin will manage that transparently for you." gives an entirely different impression!
SteveOliverC says he couldn't figure it out, so fat chance for those of us with lesser skills.
Okay, I see. We can't preload and show when needed, but it effectively preloads. Hacking only needed if we want to show the ad at a later point from when it's loaded.
Yep, that’s what that quote tries to say.
So then this issue is fixed? or was never an issue to begin with? Or I am not understanding what is going on here? Because when I use this plugin on a production account (IE, not using test interstitials), the delay between calling this method and the when the interstitial appears can be up to several seconds. So a user taps a button and I want the interstitial to appear at that action. But if the interstitial appears 3 seconds later, that is a clear violation of Admob terms. I have been flagged by Admob before and believe me, it ain't pretty. Firstly, they simply turn off your revenue. Then you notice you don't get any money and you contact them. Then if you are lucky they respond and explain why they turned off your money. Otherwise you are left trying to figure it out. Finally, if too many of your apps misbehave, they simply turn off your account (luckily I fixed my app before that happened).
It is an issue as outlined on this google page. The delay we get means that the next action has started before the interstitial ad is shown. We definitely need to separate out the loading and the showing into two functions.
I've just tried using calebeaires solution to load and another function to show the ad. It works on the emulator but won't load on an actual device, onAdFailedToLoad returns an error code 0. I'm currently stumped.
Let me try to be clear:
FYI I'm spending my weekend fixing this. iOS is already done. Android tomorrow. There will be 2 new methods: preloadInterstitial
(with the same parameters as the current createInterstitial
), and showInterstitial
which should not be called before the promise of preloadInterstitial
resolves, but can be called a long time after it has been preloaded.
UPDATE: Android is done as well. And the demo has been updated (you can already take a look). Need to document it and release it tomorrow.
Is it fixed in nativescript-plugin-firebase as well?
@umair-ameen Not by magic 💫😉. I'll spend some time there as well today.
2.0.0 released, see the updated docs.
@umair-ameen Check https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/934 - now available from npm in nativescript-plugin-firebase version 7.1.1.
@EddyVerbruggen Thank you so much Eddy. You are awesome.
@EddyVerbruggen NICE work!!!
Brilliant, thanks!
Thanks @EddyVerbruggen!
Admob team contact me about policy from interstital implementation. They suggest to preload the ad first (ex: when app starts), then show on needed.
This is useful to "Rewarded mediation": https://support.google.com/admob/answer/3063564?hl=en
I have did some modification. It is not the final implementation, but It is a start.