Skip to content

[📚] initialize method is inconsistent between the documentation and the example #793

@F170x

Description

@F170x

Documentation Feedback

Hello, I was improving the startup performance of our app and noticed that when we test with a very slow connection (128 kbps), the initialize method takes about 10 seconds to respond.

The documentation says:

Initialize the Google Mobile Ads SDK

Before loading ads, have your app initialize the Google Mobile Ads SDK by calling initialize which initializes the SDK and returns a promise once initialization is complete (or after a 30-second timeout). This needs to be done only once, ideally at app launch.

Source: https://docs.page/invertase/react-native-google-mobile-ads#initialize-the-google-mobile-ads-sdk

I have a few questions:

The example only calls the initialize method on Android, does not wait for the promise, and mentions that it's only used for the debug menu:

  constructor() {
    // Android requires SDK initialization before opening the Debug Menu
    Platform.OS === 'android' && MobileAds().initialize().catch(console.error);
  }

Source: https://github.com/invertase/react-native-google-mobile-ads/blob/main/RNGoogleMobileAdsExample/App.tsx#L1119C1-L1122C4

I tested removing it, and everything still seems to work fine, at least test ads are loading correctly.

My question is: Is it required to use the initialize method, or is it safe to remove it? Alternatively, should I still call it but avoid waiting for the promise before loading ads?

Also, the documentation mentions a 30 seconds timeout, but in my case I consistently get a response after 10 seconds. Does this mean the current timeout is actually 10 seconds instead of 30?

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions