invertase / react-native-google-mobile-ads

React Native Google Mobile Ads enables you to monetize your app with AdMob.
https://docs.page/invertase/react-native-google-mobile-ads
Other
686 stars 139 forks source link

[Question] Reload Banner #284

Closed quan2nd closed 1 year ago

quan2nd commented 1 year ago

Documentation Feedback

Hello. I have 2 questions.

  1. Is there any way I can reload the banner?
  2. Is there a mechanism to reload the banner in the library after a period of time or after the first loading of the banner fails? Thank you.
mikehardy commented 1 year ago

🤔

https://github.com/invertase/react-native-google-mobile-ads/issues?q=is%3Aissue+reload

https://github.com/invertase/react-native-google-mobile-ads/issues/195

https://github.com/invertase/react-native-google-mobile-ads/pull/245

The library does not track time or need to reload for your, it simply does what you ask imperatively, so any related logic will be project-specific in your project code

quan2nd commented 1 year ago

@mikehardy It seems the reload function only works for interstitial and reward. I don't know how to use the Banner. I see google encourages Banner "can refresh automatically after a certain period of time." https://developers.google.com/admob/flutter/banner/get-started

dylancom commented 1 year ago

Banner ads refresh every 30 / 60 seconds. You can leave that up to AdMob. But in case you want to force reload the banner you can just set a unique key on the banner.

<BannerAd key={key} unitId={TestIds.BANNER} size={BannerAdSize.ANCHORED_ADAPTIVE_BANNER} />

Then after some event happened: setKey(Date.now())

quan2nd commented 1 year ago

Thank you. Your way solved my problem.