-
-
Notifications
You must be signed in to change notification settings - Fork 31
adLoaded never changes it's value #88
Comments
It seems that occurs on an emulator but not on a real device. Is this normal behaviour for an emulator? If it is, then is there documentation explaining why this occurs on an emulator but not on a real device? If this is normal behaviour and documentation for why it occurs exists, then this issue can be marked as closed. EditNow it does not work on my real device. The issue is persistent on both emulator and real device. |
This is expected behavior. I'm sorry I didn't explained the states' lifecycle within ad. The hook return values change like this:
As I explained above, the ad states are not initialized until the new ad is loaded. |
That makes sense. I guess it was a confusion on my end. Thanks for clearing this up for me. I will close this issue but maybe it would be good to add how each variable changes "under the hood" in the documentation so misunderstandings like this don't happen in the future. |
Description
When using the
useInterstitialAd
hook, theadLoaded
value initially gets returned astrue
. At this point, the ad is expected to be loaded. When the ad is presented, theadLoaded
value is expected to change tofalse
. However, the value does not change to false. The value remainstrue
even though no ad is loaded. I have tested this and theshow()
function does not show ad because no ad is loaded. TheadLoaded
value however, is equal totrue
thus being a false indicator for whether the ad is loaded and ready to present or not.Expected behavior
When the
useInterstitialAd
hook is called, it should return anadLoaded
value oftrue
if the ad is loaded correctly. When theshow()
function is called, theadLoaded
variable should be changed tofalse
(as the ad has been shown, and a new one needs to be loaded). The developer will most likely test if theadLoaded
variable isfalse
and the run theload()
function which should change theadLoaded
variable totrue
.Essentially, the flow should look like this:
Actual behavior & steps to reproduce
When the
useInterstitialAd
hook is called, it returns anadLoaded
value of true. When I ran theshow()
function after theuseInterstitialAd
hook, the ad was shown but theadLoaded
value remainedfalse
. The next time I ran theshow()
function, an ad was not shown, despite the fact that theadLoaded
value remainedtrue
In development, the developer will most likely rely on the
adLoaded
variable to determine whether toload()
a new ad or not.Snack or minimal code example
I've been having problems with snack and don't have time to make a repo dedicated to this issue so I'll just copy paste the code here. I have included the
adPresented
variable to compare against theadLoaded
variable.Package versions
Affected platforms
The text was updated successfully, but these errors were encountered: