Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] Initial loads of banner ads fail #58

Closed
5 tasks
birdofpreyru opened this issue Jan 23, 2022 · 2 comments · Fixed by #59
Closed
5 tasks

[🐛] Initial loads of banner ads fail #58

birdofpreyru opened this issue Jan 23, 2022 · 2 comments · Fixed by #59

Comments

@birdofpreyru
Copy link
Contributor

birdofpreyru commented Jan 23, 2022

Issue

On Android, it seems to me that when <BannerAd> is rendered, its first attempt to load an ad always fails, and no ad is displayed till something causes the banner to re-render later.

I am pretty sure I render <BannerAd> after I called setRequestConfiguration() and its result has resolved. I have configured my test device as the test device, so ad requests are supposed to be always fulfilled. The only thing I found so far, that may indicate to a bug in the lib is in the output of adb logcat I see such message about the time the banner renders without ads:

unknown:ViewManagerPropertyUpdater: Could not find generated setter for class io.invertase.googleads.ReactNativeGoogleAdsBannerAdViewManager

and I don't see such message later, when it display the ads.

I'll probably try to figure out the problem, but posting a ticket if anybody who reads it has an idea from this description, what might be wrong.


Project Files

Javascript

Click To Expand

package.json:

# N/A

admob.json:

# N/A

iOS

Click To Expand

ios/Podfile:

# N/A

Android

Click To Expand

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

 OUTPUT GOES HERE
  • Platform that you're experiencing the issue on:
    • iOS
    • Android
    • iOS but have not tested behavior on Android
    • Android but have not tested behavior on iOS
    • Both
  • Are you using TypeScript?
    • Y/N & VERSION


  • 👉 Check out Invertase on Twitter for updates on the library.
@birdofpreyru birdofpreyru added the help wanted Extra attention is needed label Jan 23, 2022
@birdofpreyru
Copy link
Contributor Author

Update: I found the bug. In Android code only setSize() method triggers requestAd(), which in turns does nothing if either size or unitId or request argument is null. However, even if you create <BannerAd> with all necessary props set at JS side, the actual sequence the native setters are called is not guaranteed, e.g. in my test setSize() is called first (and results in noop for ad request), then setUnitId() and setRequest() are called (which do not trigger ads load), and thus banner stays empty until its size is changed for some reason later.

I'll submit the patch later tonight.

birdofpreyru added a commit to birdofpreyru/react-native-google-mobile-ads that referenced this issue Jan 23, 2022
dylancom pushed a commit that referenced this issue Jan 24, 2022
* Fix: no banner ads loaded on Android in the initial render

#58
@mikehardy
Copy link
Collaborator

🎉 This issue has been resolved in version 4.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

mikehardy pushed a commit that referenced this issue Feb 7, 2022
* Fix: no banner ads loaded on Android in the initial render

#58
@mikehardy mikehardy removed the help wanted Extra attention is needed label Jun 24, 2022
Star-dev325 added a commit to Star-dev325/react-native-google-mobile-ads that referenced this issue Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants