react-native-admob / admob

Admob for React Native with powerful hooks and components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useAppOpenAd still shows after disabling it

andkom opened this issue · comments

I have paid option to disable ads:

useAppOpenAd(initialized && !disableAds ? unitId : null, {
  showOnColdStart: false,
  showOnAppForeground: true,
});

but after an user purchases ads removal, app open ad still shows on app foreground

I used AppOpenAd component and it work. In your case, I think init method not called again
Doc: https://react-native-admob.github.io/admob/docs/api/AppOpenAd

the issue is: once AppOpenAd has been initialized, there is no way do disable it runtime. Only restart the app.

Please read the doc.
Call AppOpenAd.createAd('', {
showOnColdStart: false,
showOnAppForeground: false,
})
again to disable

Note that the unitId in second must be different in first, if not, the init() method in native code will not call again

@nguyen95 Yes, that is one way to disable it, but it is not hookish way. I'll improve the code to disable just by setting unitId undefined.

@nguyen95 yeah, but it looks like a hack

Fixed in 1.2.0

@wjaykim bug is not fixed

<AppOpenAdProvider
      unitId={isPaid ? null : TestIds.APP_OPEN}
      options={{ showOnColdStart: true, showOnForeground: true }}
    >
      {/* ... */}
</AppOpenAdProvider>

if isPaid changes to true, ad still shows on app foreground

@andkom oh, thank you for reporting. This issue had been fixed, but it has been occurring again since several updates. I'll fix this issue again.

Fixed in 1.4.0

as for now showOnAppForeground behavior is not consistent, sometimes it works, sometimes not, but disabling AppOpenAd in runtime is still not working

I've tested and it's working you have to reproduce your code so that I can help you.