@javascriptcommon/react-native-google-mobile-ads 16.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +32 -0
- package/README.md +181 -0
- package/RNGoogleMobileAds.podspec +74 -0
- package/__tests__/banner.test.tsx +53 -0
- package/__tests__/consent.test.ts +33 -0
- package/__tests__/googleMobileAds.test.ts +108 -0
- package/__tests__/interstitial.test.ts +140 -0
- package/__tests__/nativeEventEmitter.test.ts +72 -0
- package/__tests__/requestOptions.test.tsx +82 -0
- package/__tests__/rewarded.test.tsx +4 -0
- package/__tests__/showOptions.test.tsx +4 -0
- package/android/.editorconfig +10 -0
- package/android/app-json.gradle +69 -0
- package/android/build.gradle +149 -0
- package/android/lint.xml +5 -0
- package/android/settings.gradle +1 -0
- package/android/src/main/AndroidManifest.xml +23 -0
- package/android/src/main/java/io/invertase/googlemobileads/OnNativeEvent.kt +23 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeAppModule.java +152 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsAppOpenModule.kt +92 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsBannerAdViewManager.java +303 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsCommon.java +277 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsConsentModule.java +293 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsEvent.java +76 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsFullScreenAdModule.kt +201 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsInterstitialModule.kt +92 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsMediaViewManager.java +79 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsModule.kt +178 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsNativeAdViewManager.java +164 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsNativeModule.kt +172 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsPackage.kt +113 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsRewardedInterstitialModule.kt +127 -0
- package/android/src/main/java/io/invertase/googlemobileads/ReactNativeGoogleMobileAdsRewardedModule.kt +121 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/RCTConvert.java +111 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeAdView.java +128 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeApp.java +34 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeEvent.java +41 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeEventEmitter.java +150 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeInitProvider.java +77 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeJSON.java +107 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeMeta.java +92 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativeModule.java +96 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/ReactNativePreferences.java +86 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/SharedUtils.java +429 -0
- package/android/src/main/java/io/invertase/googlemobileads/common/TaskExecutorService.java +124 -0
- package/android/src/main/java/io/invertase/googlemobileads/interfaces/ContextProvider.java +30 -0
- package/android/src/main/java/io/invertase/googlemobileads/interfaces/NativeError.java +28 -0
- package/android/src/main/java/io/invertase/googlemobileads/interfaces/NativeEvent.java +26 -0
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsMediaViewManagerDelegate.java +32 -0
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsMediaViewManagerInterface.java +10 -0
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsNativeViewManagerDelegate.java +36 -0
- package/android/src/oldarch/com/facebook/react/viewmanagers/RNGoogleMobileAdsNativeViewManagerInterface.java +10 -0
- package/android/src/oldarch/io/invertase/googlemobileads/NativeGoogleMobileAdsNativeModuleSpec.kt +18 -0
- package/app.plugin.js +1 -0
- package/babel.config.js +8 -0
- package/docs/ad-inspector.mdx +47 -0
- package/docs/common-reasons-for-ads-not-showing.mdx +111 -0
- package/docs/displaying-ads-hook.mdx +103 -0
- package/docs/displaying-ads.mdx +512 -0
- package/docs/european-user-consent.mdx +315 -0
- package/docs/img/logo_admob_192px.svg +19 -0
- package/docs/impression-level-ad-revenue.mdx +41 -0
- package/docs/index.mdx +508 -0
- package/docs/mediation.mdx +323 -0
- package/docs/migrating-to-v15.mdx +7 -0
- package/docs/migrating-to-v5.mdx +63 -0
- package/docs/migrating-to-v6.mdx +111 -0
- package/docs/native-ads.mdx +385 -0
- package/docs/testing.mdx +17 -0
- package/docs/video-ad_volume-control.mdx +49 -0
- package/docs.json +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAds-Bridging-Header.h +5 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsAppOpenModule.mm +104 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.h +44 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerComponent.m +221 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerView.h +34 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerView.mm +282 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsBannerViewManager.mm +87 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.h +72 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsCommon.mm +248 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsConsentModule.mm +356 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.h +53 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenAd.mm +220 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsFullScreenContentDelegate.mm +80 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsInterstitialModule.mm +106 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.h +52 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsMediaView.mm +155 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.h +32 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsModule.mm +180 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeModule.h +35 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeModule.mm +321 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeView.h +51 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsNativeView.mm +251 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.h +37 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedInterstitialModule.mm +106 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.h +36 -0
- package/ios/RNGoogleMobileAds/RNGoogleMobileAdsRewardedModule.mm +104 -0
- package/ios/RNGoogleMobileAds/common/RNAppModule.h +24 -0
- package/ios/RNGoogleMobileAds/common/RNAppModule.mm +95 -0
- package/ios/RNGoogleMobileAds/common/RNRCTEventEmitter.h +73 -0
- package/ios/RNGoogleMobileAds/common/RNRCTEventEmitter.mm +150 -0
- package/ios/RNGoogleMobileAds/common/RNSharedUtils.h +43 -0
- package/ios/RNGoogleMobileAds/common/RNSharedUtils.mm +34 -0
- package/ios/RNGoogleMobileAds.xcodeproj/project.pbxproj +377 -0
- package/ios/RNGoogleMobileAds.xcodeproj/xcshareddata/IDETemplateMacros.plist +24 -0
- package/ios_config.sh +192 -0
- package/jest.config.js +7 -0
- package/jest.setup.ts +92 -0
- package/lib/commonjs/AdEventType.js +72 -0
- package/lib/commonjs/AdEventType.js.map +1 -0
- package/lib/commonjs/AdsConsent.js +117 -0
- package/lib/commonjs/AdsConsent.js.map +1 -0
- package/lib/commonjs/AdsConsentPurposes.js +180 -0
- package/lib/commonjs/AdsConsentPurposes.js.map +1 -0
- package/lib/commonjs/AdsConsentSpecialFeatures.js +54 -0
- package/lib/commonjs/AdsConsentSpecialFeatures.js.map +1 -0
- package/lib/commonjs/BannerAdSize.js +75 -0
- package/lib/commonjs/BannerAdSize.js.map +1 -0
- package/lib/commonjs/GAMAdEventType.js +44 -0
- package/lib/commonjs/GAMAdEventType.js.map +1 -0
- package/lib/commonjs/MaxAdContentRating.js +42 -0
- package/lib/commonjs/MaxAdContentRating.js.map +1 -0
- package/lib/commonjs/MobileAds.js +63 -0
- package/lib/commonjs/MobileAds.js.map +1 -0
- package/lib/commonjs/NativeAdEventType.js +50 -0
- package/lib/commonjs/NativeAdEventType.js.map +1 -0
- package/lib/commonjs/RewardedAdEventType.js +66 -0
- package/lib/commonjs/RewardedAdEventType.js.map +1 -0
- package/lib/commonjs/TestIds.js +66 -0
- package/lib/commonjs/TestIds.js.map +1 -0
- package/lib/commonjs/ads/AppOpenAd.js +54 -0
- package/lib/commonjs/ads/AppOpenAd.js.map +1 -0
- package/lib/commonjs/ads/BannerAd.js +45 -0
- package/lib/commonjs/ads/BannerAd.js.map +1 -0
- package/lib/commonjs/ads/BaseAd.js +155 -0
- package/lib/commonjs/ads/BaseAd.js.map +1 -0
- package/lib/commonjs/ads/GAMBannerAd.js +49 -0
- package/lib/commonjs/ads/GAMBannerAd.js.map +1 -0
- package/lib/commonjs/ads/GAMInterstitialAd.js +42 -0
- package/lib/commonjs/ads/GAMInterstitialAd.js.map +1 -0
- package/lib/commonjs/ads/InterstitialAd.js +115 -0
- package/lib/commonjs/ads/InterstitialAd.js.map +1 -0
- package/lib/commonjs/ads/MobileAd.js +153 -0
- package/lib/commonjs/ads/MobileAd.js.map +1 -0
- package/lib/commonjs/ads/RewardedAd.js +128 -0
- package/lib/commonjs/ads/RewardedAd.js.map +1 -0
- package/lib/commonjs/ads/RewardedInterstitialAd.js +128 -0
- package/lib/commonjs/ads/RewardedInterstitialAd.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeAd.js +123 -0
- package/lib/commonjs/ads/native-ad/NativeAd.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeAdContext.js +26 -0
- package/lib/commonjs/ads/native-ad/NativeAdContext.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeAdView.js +52 -0
- package/lib/commonjs/ads/native-ad/NativeAdView.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeAsset.js +70 -0
- package/lib/commonjs/ads/native-ad/NativeAsset.js.map +1 -0
- package/lib/commonjs/ads/native-ad/NativeMediaView.js +61 -0
- package/lib/commonjs/ads/native-ad/NativeMediaView.js.map +1 -0
- package/lib/commonjs/common/constants.js +17 -0
- package/lib/commonjs/common/constants.js.map +1 -0
- package/lib/commonjs/common/debounce.js +18 -0
- package/lib/commonjs/common/debounce.js.map +1 -0
- package/lib/commonjs/common/index.js +47 -0
- package/lib/commonjs/common/index.js.map +1 -0
- package/lib/commonjs/common/ref.js +46 -0
- package/lib/commonjs/common/ref.js.map +1 -0
- package/lib/commonjs/common/validate.js +132 -0
- package/lib/commonjs/common/validate.js.map +1 -0
- package/lib/commonjs/declarations.d.js +2 -0
- package/lib/commonjs/declarations.d.js.map +1 -0
- package/lib/commonjs/hooks/useAppOpenAd.js +44 -0
- package/lib/commonjs/hooks/useAppOpenAd.js.map +1 -0
- package/lib/commonjs/hooks/useForeground.js +45 -0
- package/lib/commonjs/hooks/useForeground.js.map +1 -0
- package/lib/commonjs/hooks/useFullScreenAd.js +121 -0
- package/lib/commonjs/hooks/useFullScreenAd.js.map +1 -0
- package/lib/commonjs/hooks/useInterstitialAd.js +44 -0
- package/lib/commonjs/hooks/useInterstitialAd.js.map +1 -0
- package/lib/commonjs/hooks/useRewardedAd.js +44 -0
- package/lib/commonjs/hooks/useRewardedAd.js.map +1 -0
- package/lib/commonjs/hooks/useRewardedInterstitialAd.js +44 -0
- package/lib/commonjs/hooks/useRewardedInterstitialAd.js.map +1 -0
- package/lib/commonjs/index.js +337 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js +54 -0
- package/lib/commonjs/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -0
- package/lib/commonjs/internal/NativeError.js +53 -0
- package/lib/commonjs/internal/NativeError.js.map +1 -0
- package/lib/commonjs/internal/SharedEventEmitter.js +27 -0
- package/lib/commonjs/internal/SharedEventEmitter.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/components/GoogleMobileAdsBannerViewNativeComponent.ts +62 -0
- package/lib/commonjs/specs/components/GoogleMobileAdsMediaViewNativeComponent.ts +30 -0
- package/lib/commonjs/specs/components/GoogleMobileAdsNativeViewNativeComponent.ts +45 -0
- package/lib/commonjs/specs/modules/NativeAppModule.js +24 -0
- package/lib/commonjs/specs/modules/NativeAppModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeAppOpenModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeAppOpenModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeConsentModule.js +105 -0
- package/lib/commonjs/specs/modules/NativeConsentModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsNativeModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeGoogleMobileAdsNativeModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeInterstitialModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeInterstitialModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeRewardedInterstitialModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeRewardedInterstitialModule.js.map +1 -0
- package/lib/commonjs/specs/modules/NativeRewardedModule.js +25 -0
- package/lib/commonjs/specs/modules/NativeRewardedModule.js.map +1 -0
- package/lib/commonjs/types/AdEventListener.js +6 -0
- package/lib/commonjs/types/AdEventListener.js.map +1 -0
- package/lib/commonjs/types/AdEventsListener.js +6 -0
- package/lib/commonjs/types/AdEventsListener.js.map +1 -0
- package/lib/commonjs/types/AdShowOptions.js +2 -0
- package/lib/commonjs/types/AdShowOptions.js.map +1 -0
- package/lib/commonjs/types/AdStates.js +6 -0
- package/lib/commonjs/types/AdStates.js.map +1 -0
- package/lib/commonjs/types/AdapterStatus.js +21 -0
- package/lib/commonjs/types/AdapterStatus.js.map +1 -0
- package/lib/commonjs/types/AppEvent.js +2 -0
- package/lib/commonjs/types/AppEvent.js.map +1 -0
- package/lib/commonjs/types/BannerAdProps.js +6 -0
- package/lib/commonjs/types/BannerAdProps.js.map +1 -0
- package/lib/commonjs/types/MobileAd.interface.js +6 -0
- package/lib/commonjs/types/MobileAd.interface.js.map +1 -0
- package/lib/commonjs/types/MobileAdsModule.interface.js +6 -0
- package/lib/commonjs/types/MobileAdsModule.interface.js.map +1 -0
- package/lib/commonjs/types/NativeAdRequestOptions.js +37 -0
- package/lib/commonjs/types/NativeAdRequestOptions.js.map +1 -0
- package/lib/commonjs/types/PaidEventListener.js +6 -0
- package/lib/commonjs/types/PaidEventListener.js.map +1 -0
- package/lib/commonjs/types/RequestConfiguration.js +6 -0
- package/lib/commonjs/types/RequestConfiguration.js.map +1 -0
- package/lib/commonjs/types/RequestOptions.js +2 -0
- package/lib/commonjs/types/RequestOptions.js.map +1 -0
- package/lib/commonjs/types/RewardedAdReward.js +2 -0
- package/lib/commonjs/types/RewardedAdReward.js.map +1 -0
- package/lib/commonjs/types/index.js +138 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/validateAdRequestConfiguration.js +57 -0
- package/lib/commonjs/validateAdRequestConfiguration.js.map +1 -0
- package/lib/commonjs/validateAdRequestOptions.js +121 -0
- package/lib/commonjs/validateAdRequestOptions.js.map +1 -0
- package/lib/commonjs/validateAdShowOptions.js +41 -0
- package/lib/commonjs/validateAdShowOptions.js.map +1 -0
- package/lib/commonjs/validateNativeAdRequestOptions.js +51 -0
- package/lib/commonjs/validateNativeAdRequestOptions.js.map +1 -0
- package/lib/commonjs/version.js +9 -0
- package/lib/commonjs/version.js.map +1 -0
- package/lib/module/AdEventType.js +69 -0
- package/lib/module/AdEventType.js.map +1 -0
- package/lib/module/AdsConsent.js +113 -0
- package/lib/module/AdsConsent.js.map +1 -0
- package/lib/module/AdsConsentPurposes.js +177 -0
- package/lib/module/AdsConsentPurposes.js.map +1 -0
- package/lib/module/AdsConsentSpecialFeatures.js +51 -0
- package/lib/module/AdsConsentSpecialFeatures.js.map +1 -0
- package/lib/module/BannerAdSize.js +72 -0
- package/lib/module/BannerAdSize.js.map +1 -0
- package/lib/module/GAMAdEventType.js +41 -0
- package/lib/module/GAMAdEventType.js.map +1 -0
- package/lib/module/MaxAdContentRating.js +39 -0
- package/lib/module/MaxAdContentRating.js.map +1 -0
- package/lib/module/MobileAds.js +57 -0
- package/lib/module/MobileAds.js.map +1 -0
- package/lib/module/NativeAdEventType.js +46 -0
- package/lib/module/NativeAdEventType.js.map +1 -0
- package/lib/module/RewardedAdEventType.js +63 -0
- package/lib/module/RewardedAdEventType.js.map +1 -0
- package/lib/module/TestIds.js +62 -0
- package/lib/module/TestIds.js.map +1 -0
- package/lib/module/ads/AppOpenAd.js +48 -0
- package/lib/module/ads/AppOpenAd.js.map +1 -0
- package/lib/module/ads/BannerAd.js +39 -0
- package/lib/module/ads/BannerAd.js.map +1 -0
- package/lib/module/ads/BaseAd.js +149 -0
- package/lib/module/ads/BaseAd.js.map +1 -0
- package/lib/module/ads/GAMBannerAd.js +43 -0
- package/lib/module/ads/GAMBannerAd.js.map +1 -0
- package/lib/module/ads/GAMInterstitialAd.js +37 -0
- package/lib/module/ads/GAMInterstitialAd.js.map +1 -0
- package/lib/module/ads/InterstitialAd.js +110 -0
- package/lib/module/ads/InterstitialAd.js.map +1 -0
- package/lib/module/ads/MobileAd.js +148 -0
- package/lib/module/ads/MobileAd.js.map +1 -0
- package/lib/module/ads/RewardedAd.js +123 -0
- package/lib/module/ads/RewardedAd.js.map +1 -0
- package/lib/module/ads/RewardedInterstitialAd.js +123 -0
- package/lib/module/ads/RewardedInterstitialAd.js.map +1 -0
- package/lib/module/ads/native-ad/NativeAd.js +117 -0
- package/lib/module/ads/native-ad/NativeAd.js.map +1 -0
- package/lib/module/ads/native-ad/NativeAdContext.js +22 -0
- package/lib/module/ads/native-ad/NativeAdContext.js.map +1 -0
- package/lib/module/ads/native-ad/NativeAdView.js +45 -0
- package/lib/module/ads/native-ad/NativeAdView.js.map +1 -0
- package/lib/module/ads/native-ad/NativeAsset.js +65 -0
- package/lib/module/ads/native-ad/NativeAsset.js.map +1 -0
- package/lib/module/ads/native-ad/NativeMediaView.js +54 -0
- package/lib/module/ads/native-ad/NativeMediaView.js.map +1 -0
- package/lib/module/common/constants.js +13 -0
- package/lib/module/common/constants.js.map +1 -0
- package/lib/module/common/debounce.js +13 -0
- package/lib/module/common/debounce.js.map +1 -0
- package/lib/module/common/index.js +28 -0
- package/lib/module/common/index.js.map +1 -0
- package/lib/module/common/ref.js +41 -0
- package/lib/module/common/ref.js.map +1 -0
- package/lib/module/common/validate.js +119 -0
- package/lib/module/common/validate.js.map +1 -0
- package/lib/module/declarations.d.js +2 -0
- package/lib/module/declarations.d.js.map +1 -0
- package/lib/module/hooks/useAppOpenAd.js +40 -0
- package/lib/module/hooks/useAppOpenAd.js.map +1 -0
- package/lib/module/hooks/useForeground.js +42 -0
- package/lib/module/hooks/useForeground.js.map +1 -0
- package/lib/module/hooks/useFullScreenAd.js +117 -0
- package/lib/module/hooks/useFullScreenAd.js.map +1 -0
- package/lib/module/hooks/useInterstitialAd.js +40 -0
- package/lib/module/hooks/useInterstitialAd.js.map +1 -0
- package/lib/module/hooks/useRewardedAd.js +40 -0
- package/lib/module/hooks/useRewardedAd.js.map +1 -0
- package/lib/module/hooks/useRewardedInterstitialAd.js +40 -0
- package/lib/module/hooks/useRewardedInterstitialAd.js.map +1 -0
- package/lib/module/index.js +54 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js +49 -0
- package/lib/module/internal/GoogleMobileAdsNativeEventEmitter.js.map +1 -0
- package/lib/module/internal/NativeError.js +48 -0
- package/lib/module/internal/NativeError.js.map +1 -0
- package/lib/module/internal/SharedEventEmitter.js +22 -0
- package/lib/module/internal/SharedEventEmitter.js.map +1 -0
- package/lib/module/specs/components/GoogleMobileAdsBannerViewNativeComponent.ts +62 -0
- package/lib/module/specs/components/GoogleMobileAdsMediaViewNativeComponent.ts +30 -0
- package/lib/module/specs/components/GoogleMobileAdsNativeViewNativeComponent.ts +45 -0
- package/lib/module/specs/modules/NativeAppModule.js +21 -0
- package/lib/module/specs/modules/NativeAppModule.js.map +1 -0
- package/lib/module/specs/modules/NativeAppOpenModule.js +22 -0
- package/lib/module/specs/modules/NativeAppOpenModule.js.map +1 -0
- package/lib/module/specs/modules/NativeConsentModule.js +108 -0
- package/lib/module/specs/modules/NativeConsentModule.js.map +1 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsModule.js +22 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsModule.js.map +1 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsNativeModule.js +22 -0
- package/lib/module/specs/modules/NativeGoogleMobileAdsNativeModule.js.map +1 -0
- package/lib/module/specs/modules/NativeInterstitialModule.js +22 -0
- package/lib/module/specs/modules/NativeInterstitialModule.js.map +1 -0
- package/lib/module/specs/modules/NativeRewardedInterstitialModule.js +22 -0
- package/lib/module/specs/modules/NativeRewardedInterstitialModule.js.map +1 -0
- package/lib/module/specs/modules/NativeRewardedModule.js +22 -0
- package/lib/module/specs/modules/NativeRewardedModule.js.map +1 -0
- package/lib/module/types/AdEventListener.js +4 -0
- package/lib/module/types/AdEventListener.js.map +1 -0
- package/lib/module/types/AdEventsListener.js +4 -0
- package/lib/module/types/AdEventsListener.js.map +1 -0
- package/lib/module/types/AdShowOptions.js +2 -0
- package/lib/module/types/AdShowOptions.js.map +1 -0
- package/lib/module/types/AdStates.js +4 -0
- package/lib/module/types/AdStates.js.map +1 -0
- package/lib/module/types/AdapterStatus.js +18 -0
- package/lib/module/types/AdapterStatus.js.map +1 -0
- package/lib/module/types/AppEvent.js +2 -0
- package/lib/module/types/AppEvent.js.map +1 -0
- package/lib/module/types/BannerAdProps.js +4 -0
- package/lib/module/types/BannerAdProps.js.map +1 -0
- package/lib/module/types/MobileAd.interface.js +4 -0
- package/lib/module/types/MobileAd.interface.js.map +1 -0
- package/lib/module/types/MobileAdsModule.interface.js +4 -0
- package/lib/module/types/MobileAdsModule.interface.js.map +1 -0
- package/lib/module/types/NativeAdRequestOptions.js +34 -0
- package/lib/module/types/NativeAdRequestOptions.js.map +1 -0
- package/lib/module/types/PaidEventListener.js +4 -0
- package/lib/module/types/PaidEventListener.js.map +1 -0
- package/lib/module/types/RequestConfiguration.js +4 -0
- package/lib/module/types/RequestConfiguration.js.map +1 -0
- package/lib/module/types/RequestOptions.js +2 -0
- package/lib/module/types/RequestOptions.js.map +1 -0
- package/lib/module/types/RewardedAdReward.js +2 -0
- package/lib/module/types/RewardedAdReward.js.map +1 -0
- package/lib/module/types/index.js +32 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/validateAdRequestConfiguration.js +53 -0
- package/lib/module/validateAdRequestConfiguration.js.map +1 -0
- package/lib/module/validateAdRequestOptions.js +117 -0
- package/lib/module/validateAdRequestOptions.js.map +1 -0
- package/lib/module/validateAdShowOptions.js +37 -0
- package/lib/module/validateAdShowOptions.js.map +1 -0
- package/lib/module/validateNativeAdRequestOptions.js +47 -0
- package/lib/module/validateNativeAdRequestOptions.js.map +1 -0
- package/lib/module/version.js +5 -0
- package/lib/module/version.js.map +1 -0
- package/lib/typescript/AdEventType.d.ts +49 -0
- package/lib/typescript/AdEventType.d.ts.map +1 -0
- package/lib/typescript/AdsConsent.d.ts +3 -0
- package/lib/typescript/AdsConsent.d.ts.map +1 -0
- package/lib/typescript/AdsConsentPurposes.d.ts +149 -0
- package/lib/typescript/AdsConsentPurposes.d.ts.map +1 -0
- package/lib/typescript/AdsConsentSpecialFeatures.d.ts +23 -0
- package/lib/typescript/AdsConsentSpecialFeatures.d.ts.map +1 -0
- package/lib/typescript/BannerAdSize.d.ts +91 -0
- package/lib/typescript/BannerAdSize.d.ts.map +1 -0
- package/lib/typescript/GAMAdEventType.d.ts +21 -0
- package/lib/typescript/GAMAdEventType.d.ts.map +1 -0
- package/lib/typescript/MaxAdContentRating.d.ts +19 -0
- package/lib/typescript/MaxAdContentRating.d.ts.map +1 -0
- package/lib/typescript/MobileAds.d.ts +15 -0
- package/lib/typescript/MobileAds.d.ts.map +1 -0
- package/lib/typescript/NativeAdEventType.d.ts +43 -0
- package/lib/typescript/NativeAdEventType.d.ts.map +1 -0
- package/lib/typescript/RewardedAdEventType.d.ts +43 -0
- package/lib/typescript/RewardedAdEventType.d.ts.map +1 -0
- package/lib/typescript/TestIds.d.ts +19 -0
- package/lib/typescript/TestIds.d.ts.map +1 -0
- package/lib/typescript/ads/AppOpenAd.d.ts +12 -0
- package/lib/typescript/ads/AppOpenAd.d.ts.map +1 -0
- package/lib/typescript/ads/BannerAd.d.ts +8 -0
- package/lib/typescript/ads/BannerAd.d.ts.map +1 -0
- package/lib/typescript/ads/BaseAd.d.ts +4 -0
- package/lib/typescript/ads/BaseAd.d.ts.map +1 -0
- package/lib/typescript/ads/GAMBannerAd.d.ts +9 -0
- package/lib/typescript/ads/GAMBannerAd.d.ts.map +1 -0
- package/lib/typescript/ads/GAMInterstitialAd.d.ts +34 -0
- package/lib/typescript/ads/GAMInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/ads/InterstitialAd.d.ts +73 -0
- package/lib/typescript/ads/InterstitialAd.d.ts.map +1 -0
- package/lib/typescript/ads/MobileAd.d.ts +54 -0
- package/lib/typescript/ads/MobileAd.d.ts.map +1 -0
- package/lib/typescript/ads/RewardedAd.d.ts +83 -0
- package/lib/typescript/ads/RewardedAd.d.ts.map +1 -0
- package/lib/typescript/ads/RewardedInterstitialAd.d.ts +83 -0
- package/lib/typescript/ads/RewardedInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeAd.d.ts +48 -0
- package/lib/typescript/ads/native-ad/NativeAd.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeAdContext.d.ts +10 -0
- package/lib/typescript/ads/native-ad/NativeAdContext.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeAdView.d.ts +8 -0
- package/lib/typescript/ads/native-ad/NativeAdView.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeAsset.d.ts +18 -0
- package/lib/typescript/ads/native-ad/NativeAsset.d.ts.map +1 -0
- package/lib/typescript/ads/native-ad/NativeMediaView.d.ts +7 -0
- package/lib/typescript/ads/native-ad/NativeMediaView.d.ts.map +1 -0
- package/lib/typescript/common/constants.d.ts +7 -0
- package/lib/typescript/common/constants.d.ts.map +1 -0
- package/lib/typescript/common/debounce.d.ts +2 -0
- package/lib/typescript/common/debounce.d.ts.map +1 -0
- package/lib/typescript/common/index.d.ts +4 -0
- package/lib/typescript/common/index.d.ts.map +1 -0
- package/lib/typescript/common/ref.d.ts +13 -0
- package/lib/typescript/common/ref.d.ts.map +1 -0
- package/lib/typescript/common/validate.d.ts +62 -0
- package/lib/typescript/common/validate.d.ts.map +1 -0
- package/lib/typescript/hooks/useAppOpenAd.d.ts +10 -0
- package/lib/typescript/hooks/useAppOpenAd.d.ts.map +1 -0
- package/lib/typescript/hooks/useForeground.d.ts +7 -0
- package/lib/typescript/hooks/useForeground.d.ts.map +1 -0
- package/lib/typescript/hooks/useFullScreenAd.d.ts +7 -0
- package/lib/typescript/hooks/useFullScreenAd.d.ts.map +1 -0
- package/lib/typescript/hooks/useInterstitialAd.d.ts +10 -0
- package/lib/typescript/hooks/useInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/hooks/useRewardedAd.d.ts +10 -0
- package/lib/typescript/hooks/useRewardedAd.d.ts.map +1 -0
- package/lib/typescript/hooks/useRewardedInterstitialAd.d.ts +10 -0
- package/lib/typescript/hooks/useRewardedInterstitialAd.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +32 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/internal/GoogleMobileAdsNativeEventEmitter.d.ts +13 -0
- package/lib/typescript/internal/GoogleMobileAdsNativeEventEmitter.d.ts.map +1 -0
- package/lib/typescript/internal/NativeError.d.ts +27 -0
- package/lib/typescript/internal/NativeError.d.ts.map +1 -0
- package/lib/typescript/internal/SharedEventEmitter.d.ts +3 -0
- package/lib/typescript/internal/SharedEventEmitter.d.ts.map +1 -0
- package/lib/typescript/specs/components/GoogleMobileAdsBannerViewNativeComponent.d.ts +35 -0
- package/lib/typescript/specs/components/GoogleMobileAdsBannerViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/components/GoogleMobileAdsMediaViewNativeComponent.d.ts +9 -0
- package/lib/typescript/specs/components/GoogleMobileAdsMediaViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/components/GoogleMobileAdsNativeViewNativeComponent.d.ts +14 -0
- package/lib/typescript/specs/components/GoogleMobileAdsNativeViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeAppModule.d.ts +23 -0
- package/lib/typescript/specs/modules/NativeAppModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeAppOpenModule.d.ts +25 -0
- package/lib/typescript/specs/modules/NativeAppOpenModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeConsentModule.d.ts +498 -0
- package/lib/typescript/specs/modules/NativeConsentModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts +14 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsNativeModule.d.ts +42 -0
- package/lib/typescript/specs/modules/NativeGoogleMobileAdsNativeModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeInterstitialModule.d.ts +25 -0
- package/lib/typescript/specs/modules/NativeInterstitialModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeRewardedInterstitialModule.d.ts +25 -0
- package/lib/typescript/specs/modules/NativeRewardedInterstitialModule.d.ts.map +1 -0
- package/lib/typescript/specs/modules/NativeRewardedModule.d.ts +25 -0
- package/lib/typescript/specs/modules/NativeRewardedModule.d.ts.map +1 -0
- package/lib/typescript/types/AdEventListener.d.ts +8 -0
- package/lib/typescript/types/AdEventListener.d.ts.map +1 -0
- package/lib/typescript/types/AdEventsListener.d.ts +9 -0
- package/lib/typescript/types/AdEventsListener.d.ts.map +1 -0
- package/lib/typescript/types/AdShowOptions.d.ts +13 -0
- package/lib/typescript/types/AdShowOptions.d.ts.map +1 -0
- package/lib/typescript/types/AdStates.d.ts +91 -0
- package/lib/typescript/types/AdStates.d.ts.map +1 -0
- package/lib/typescript/types/AdapterStatus.d.ts +19 -0
- package/lib/typescript/types/AdapterStatus.d.ts.map +1 -0
- package/lib/typescript/types/AppEvent.d.ts +14 -0
- package/lib/typescript/types/AppEvent.d.ts.map +1 -0
- package/lib/typescript/types/BannerAdProps.d.ts +175 -0
- package/lib/typescript/types/BannerAdProps.d.ts.map +1 -0
- package/lib/typescript/types/MobileAd.interface.d.ts +90 -0
- package/lib/typescript/types/MobileAd.interface.d.ts.map +1 -0
- package/lib/typescript/types/MobileAdsModule.interface.d.ts +75 -0
- package/lib/typescript/types/MobileAdsModule.interface.d.ts.map +1 -0
- package/lib/typescript/types/NativeAdRequestOptions.d.ts +36 -0
- package/lib/typescript/types/NativeAdRequestOptions.d.ts.map +1 -0
- package/lib/typescript/types/PaidEventListener.d.ts +8 -0
- package/lib/typescript/types/PaidEventListener.d.ts.map +1 -0
- package/lib/typescript/types/RequestConfiguration.d.ts +37 -0
- package/lib/typescript/types/RequestConfiguration.d.ts.map +1 -0
- package/lib/typescript/types/RequestOptions.d.ts +133 -0
- package/lib/typescript/types/RequestOptions.d.ts.map +1 -0
- package/lib/typescript/types/RewardedAdReward.d.ts +14 -0
- package/lib/typescript/types/RewardedAdReward.d.ts.map +1 -0
- package/lib/typescript/types/index.d.ts +13 -0
- package/lib/typescript/types/index.d.ts.map +1 -0
- package/lib/typescript/validateAdRequestConfiguration.d.ts +3 -0
- package/lib/typescript/validateAdRequestConfiguration.d.ts.map +1 -0
- package/lib/typescript/validateAdRequestOptions.d.ts +3 -0
- package/lib/typescript/validateAdRequestOptions.d.ts.map +1 -0
- package/lib/typescript/validateAdShowOptions.d.ts +3 -0
- package/lib/typescript/validateAdShowOptions.d.ts.map +1 -0
- package/lib/typescript/validateNativeAdRequestOptions.d.ts +3 -0
- package/lib/typescript/validateNativeAdRequestOptions.d.ts.map +1 -0
- package/lib/typescript/version.d.ts +2 -0
- package/lib/typescript/version.d.ts.map +1 -0
- package/package.json +176 -0
- package/plugin/__tests__/__snapshots__/plugin.test.ts.snap +739 -0
- package/plugin/__tests__/fixtures/app.config.js +24 -0
- package/plugin/__tests__/fixtures/app.config.ts +24 -0
- package/plugin/__tests__/fixtures/app.json +24 -0
- package/plugin/__tests__/fixtures/package.json +19 -0
- package/plugin/__tests__/fixtures/without-params/app.config.js +11 -0
- package/plugin/__tests__/fixtures/without-params/app.config.ts +11 -0
- package/plugin/__tests__/fixtures/without-params/app.json +11 -0
- package/plugin/__tests__/plugin.test.ts +115 -0
- package/plugin/build/index.d.ts +12 -0
- package/plugin/build/index.js +109 -0
- package/plugin/jest.config.js +1 -0
- package/plugin/src/index.ts +205 -0
- package/plugin/tsconfig.json +9 -0
- package/plugin/tsconfig.tsbuildinfo +1 -0
- package/react-native.config.js +19 -0
- package/src/AdEventType.ts +70 -0
- package/src/AdsConsent.ts +170 -0
- package/src/AdsConsentPurposes.ts +182 -0
- package/src/AdsConsentSpecialFeatures.ts +48 -0
- package/src/BannerAdSize.ts +78 -0
- package/src/GAMAdEventType.ts +37 -0
- package/src/MaxAdContentRating.ts +38 -0
- package/src/MobileAds.ts +77 -0
- package/src/NativeAdEventType.ts +51 -0
- package/src/RewardedAdEventType.ts +60 -0
- package/src/TestIds.ts +60 -0
- package/src/ads/AppOpenAd.ts +62 -0
- package/src/ads/BannerAd.tsx +37 -0
- package/src/ads/BaseAd.tsx +185 -0
- package/src/ads/GAMBannerAd.tsx +43 -0
- package/src/ads/GAMInterstitialAd.ts +45 -0
- package/src/ads/InterstitialAd.ts +122 -0
- package/src/ads/MobileAd.ts +227 -0
- package/src/ads/RewardedAd.ts +142 -0
- package/src/ads/RewardedInterstitialAd.ts +144 -0
- package/src/ads/native-ad/NativeAd.ts +159 -0
- package/src/ads/native-ad/NativeAdContext.ts +26 -0
- package/src/ads/native-ad/NativeAdView.tsx +43 -0
- package/src/ads/native-ad/NativeAsset.tsx +66 -0
- package/src/ads/native-ad/NativeMediaView.tsx +44 -0
- package/src/common/constants.ts +9 -0
- package/src/common/debounce.ts +15 -0
- package/src/common/index.ts +30 -0
- package/src/common/ref.ts +46 -0
- package/src/common/validate.ts +116 -0
- package/src/declarations.d.ts +3 -0
- package/src/hooks/useAppOpenAd.ts +46 -0
- package/src/hooks/useForeground.ts +41 -0
- package/src/hooks/useFullScreenAd.ts +112 -0
- package/src/hooks/useInterstitialAd.ts +46 -0
- package/src/hooks/useRewardedAd.ts +46 -0
- package/src/hooks/useRewardedInterstitialAd.ts +47 -0
- package/src/index.ts +60 -0
- package/src/internal/GoogleMobileAdsNativeEventEmitter.ts +58 -0
- package/src/internal/NativeError.ts +56 -0
- package/src/internal/SharedEventEmitter.ts +20 -0
- package/src/specs/components/GoogleMobileAdsBannerViewNativeComponent.ts +62 -0
- package/src/specs/components/GoogleMobileAdsMediaViewNativeComponent.ts +30 -0
- package/src/specs/components/GoogleMobileAdsNativeViewNativeComponent.ts +45 -0
- package/src/specs/modules/NativeAppModule.ts +57 -0
- package/src/specs/modules/NativeAppOpenModule.ts +26 -0
- package/src/specs/modules/NativeConsentModule.ts +532 -0
- package/src/specs/modules/NativeGoogleMobileAdsModule.ts +33 -0
- package/src/specs/modules/NativeGoogleMobileAdsNativeModule.ts +70 -0
- package/src/specs/modules/NativeInterstitialModule.ts +26 -0
- package/src/specs/modules/NativeRewardedInterstitialModule.ts +32 -0
- package/src/specs/modules/NativeRewardedModule.ts +26 -0
- package/src/types/AdEventListener.ts +34 -0
- package/src/types/AdEventsListener.ts +24 -0
- package/src/types/AdShowOptions.ts +12 -0
- package/src/types/AdStates.ts +92 -0
- package/src/types/AdapterStatus.ts +20 -0
- package/src/types/AppEvent.ts +14 -0
- package/src/types/BannerAdProps.ts +184 -0
- package/src/types/MobileAd.interface.ts +113 -0
- package/src/types/MobileAdsModule.interface.ts +80 -0
- package/src/types/NativeAdRequestOptions.ts +55 -0
- package/src/types/PaidEventListener.ts +9 -0
- package/src/types/RequestConfiguration.ts +40 -0
- package/src/types/RequestOptions.ts +137 -0
- package/src/types/RewardedAdReward.ts +14 -0
- package/src/types/index.ts +29 -0
- package/src/validateAdRequestConfiguration.ts +66 -0
- package/src/validateAdRequestOptions.ts +154 -0
- package/src/validateAdShowOptions.ts +41 -0
- package/src/validateNativeAdRequestOptions.ts +50 -0
- package/src/version.ts +2 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
# Native Ads
|
|
2
|
+
|
|
3
|
+
Native ads are ad assets that are presented to users through UI components that are native to the platform.
|
|
4
|
+
They're shown using the same types of views with which you're already building your layouts, and can be formatted to match your app's visual design.
|
|
5
|
+
|
|
6
|
+
When a native ad loads, your app receives an ad object that contains its assets, and the app — rather than the Google Mobile Ads SDK — is responsible for displaying them.
|
|
7
|
+
|
|
8
|
+
Broadly speaking, there are two parts to successfully implementing native ads: Loading an ad using the SDK and then displaying the ad content in your app.
|
|
9
|
+
|
|
10
|
+
## Load ads
|
|
11
|
+
|
|
12
|
+
Native ads are loaded with `NativeAd.createForAdRequest` static method, which returns a promise that resolves with a `NativeAd` object.
|
|
13
|
+
The first argument of the method is the "Ad Unit ID".
|
|
14
|
+
For testing, we can use a Test ID, however for production the ID from the Google AdMob dashboard under "Ad units" should be used:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
NativeAd.createForAdRequest(TestIds.NATIVE)
|
|
18
|
+
.then(setNativeAd)
|
|
19
|
+
.catch(console.error);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Native ad Options
|
|
23
|
+
|
|
24
|
+
Native ads have many advanced features that allow you to make additional customizations to create the best possible ad experience.
|
|
25
|
+
|
|
26
|
+
You can pass an optional `NativeAdRequestOptions` object as the second argument to `NativeAd.createForAdRequest` to customize the ad request:
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
NativeAd.createForAdRequest(TestIds.NATIVE, {
|
|
30
|
+
aspectRatio: NativeMediaAspectRatio.LANDSCAPE,
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
#### Preferred media aspect ratio controls
|
|
35
|
+
|
|
36
|
+
Media Aspect Ratio Controls let you specify a preference for the aspect ratio of ad creatives.
|
|
37
|
+
|
|
38
|
+
<Info>
|
|
39
|
+
Use of this API does not guarantee that all ad creatives will meet the preference specified.
|
|
40
|
+
</Info>
|
|
41
|
+
|
|
42
|
+
Specify `requestOptions.aspectRatio` with a `NativeMediaAspectRatio` enum value when calling `NativeAd.createForAdRequest`.
|
|
43
|
+
|
|
44
|
+
- When unset, the returned ad can have any media aspect ratio.
|
|
45
|
+
- When set, you will be able to improve the user experience by specifying the preferred type of aspect ratio.
|
|
46
|
+
|
|
47
|
+
The following example instructs the SDK to prefer a return image or video with a specific aspect ratio.
|
|
48
|
+
|
|
49
|
+
```tsx
|
|
50
|
+
NativeAd.createForAdRequest(TestIds.NATIVE, {
|
|
51
|
+
aspectRatio: NativeMediaAspectRatio.LANDSCAPE,
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
#### AdChoices placements
|
|
56
|
+
|
|
57
|
+
The AdChoices position controls lets you choose which corner to render the AdChoices icon.
|
|
58
|
+
|
|
59
|
+
Specify `requestOptions.adChoicesPlacement` with a `NativeAdChoicesPlacement` enum value when calling `NativeAd.createForAdRequest`.
|
|
60
|
+
|
|
61
|
+
- If unset, the AdChoices icon position is set to the top right.
|
|
62
|
+
- If set, AdChoices is placed at the custom position as requested.
|
|
63
|
+
|
|
64
|
+
The following example demonstrates how to set a custom AdChoices image position.
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
NativeAd.createForAdRequest(TestIds.NATIVE, {
|
|
68
|
+
adChoicesPlacement: NativeAdChoicesPlacement.TOP_LEFT,
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
#### Start mute behavior
|
|
73
|
+
|
|
74
|
+
The start muted behavior lets you disable or enable a video's starting audio.
|
|
75
|
+
|
|
76
|
+
Specify `requestOptions.startVideoMuted` with a boolean value when calling `NativeAd.createForAdRequest`.
|
|
77
|
+
|
|
78
|
+
- The start muted behavior is enabled by default.
|
|
79
|
+
- When disabled, your app requests the video should begin with audio.
|
|
80
|
+
- When enabled, your app requests that the video should begin with audio muted.
|
|
81
|
+
|
|
82
|
+
The following example shows how to start the video with un-muted audio.
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
NativeAd.createForAdRequest(TestIds.NATIVE, {
|
|
86
|
+
startVideoMuted: false,
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
#### Other Ad Request Options
|
|
91
|
+
You can specify other request options to be sent while loading an advert, such as keywords and location.
|
|
92
|
+
Setting additional request options helps AdMob choose better tailored ads from the network.
|
|
93
|
+
View the [RequestOptions](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/types/RequestOptions.ts) source code to see the full range of options available.
|
|
94
|
+
|
|
95
|
+
## Display ads
|
|
96
|
+
|
|
97
|
+
When a native ad loads, your app is then responsible for displaying the ad (though it doesn't necessarily have to do so immediately).
|
|
98
|
+
To make displaying system-defined ad formats easier, the SDK offers some useful resources, as described below.
|
|
99
|
+
|
|
100
|
+
### NativeAdView component
|
|
101
|
+
|
|
102
|
+
For the NativeAd format, there is the corresponding `NativeAdView` component.
|
|
103
|
+
This component is a wrapper component that publishers should use as the root for the NativeAd.
|
|
104
|
+
A single `NativeAdView` corresponds to a single native ad.
|
|
105
|
+
Each view used to display that ads assets should be placed within the view hierarchy of the `NativeAdView` component.
|
|
106
|
+
Pass the `NativeAd` object to the `nativeAd` prop of the `NativeAdView` component to register the ad view:
|
|
107
|
+
|
|
108
|
+
```tsx
|
|
109
|
+
const NativeComponent = () => {
|
|
110
|
+
const [nativeAd, setNativeAd] = useState<NativeAd>();
|
|
111
|
+
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
NativeAd.createForAdRequest(TestIds.NATIVE)
|
|
114
|
+
.then(setNativeAd)
|
|
115
|
+
.catch(console.error);
|
|
116
|
+
}, []);
|
|
117
|
+
|
|
118
|
+
if (!nativeAd) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return (
|
|
123
|
+
<NativeAdView nativeAd={nativeAd}>
|
|
124
|
+
// Components to display assets must be placed here
|
|
125
|
+
</NativeAdView>
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### NativeAsset component
|
|
131
|
+
|
|
132
|
+
`NativeAsset` component, which should be placed within the view hierarchy of a `NativeAdView`, is used to register the view used for each individual asset.
|
|
133
|
+
Registering the views in this way allows the SDK to automatically handle tasks such as:
|
|
134
|
+
|
|
135
|
+
- Recording clicks.
|
|
136
|
+
- Recording impressions (when the first pixel is visible on the screen).
|
|
137
|
+
- Displaying the AdChoices overlay.
|
|
138
|
+
|
|
139
|
+
`NativeAsset` component is a headless component, which means the component does not have UI implementation.
|
|
140
|
+
Customize your UI components as needed and place them inside the `NativeAsset` component, setting the `assetType` prop to the asset type you are displaying:
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
const NativeComponent = () => {
|
|
144
|
+
const [nativeAd, setNativeAd] = useState<NativeAd>();
|
|
145
|
+
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
NativeAd.createForAdRequest(TestIds.NATIVE)
|
|
148
|
+
.then(setNativeAd)
|
|
149
|
+
.catch(console.error);
|
|
150
|
+
}, []);
|
|
151
|
+
|
|
152
|
+
if (!nativeAd) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return (
|
|
157
|
+
<NativeAdView nativeAd={nativeAd}>
|
|
158
|
+
<NativeAsset assetType={NativeAssetType.HEADLINE}>
|
|
159
|
+
<Text>{nativeAd.headline}</Text>
|
|
160
|
+
</NativeAsset>
|
|
161
|
+
</NativeAdView>
|
|
162
|
+
);
|
|
163
|
+
};
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
<Warning>Place the asset view(such as `Text`, `Image` component) as a direct child of the `NativeAsset` component. See more in [Caveats: `NativeAsset` placement](/native-ads#nativeasset-placement) section.</Warning>
|
|
167
|
+
|
|
168
|
+
### NativeMediaView component
|
|
169
|
+
|
|
170
|
+
Main image and video assets are displayed to users via `NativeMediaView`. It should be placed within the view hierarchy of a `NativeAdView`, as with any other asset view.
|
|
171
|
+
|
|
172
|
+
Unlike other asset views, the `NativeMediaView` automatically populates its content.
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
const NativeComponent = () => {
|
|
176
|
+
return (
|
|
177
|
+
<NativeAdView nativeAd={nativeAd}>
|
|
178
|
+
<NativeMediaView />
|
|
179
|
+
// Other assets..
|
|
180
|
+
</NativeAdView>
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
#### Resize Mode
|
|
186
|
+
|
|
187
|
+
The `NativeMediaView` component respects the `resizeMode` property when displaying images. The `resizeMode` defaults to `cover`.
|
|
188
|
+
|
|
189
|
+
Supports the following values:
|
|
190
|
+
- `cover`: Scale the image uniformly (maintain the image's aspect ratio) so that:
|
|
191
|
+
- Both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding)
|
|
192
|
+
- At least one dimension of the scaled image will be equal to the corresponding dimension of the view (minus padding)
|
|
193
|
+
- `contain`: Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding).
|
|
194
|
+
- `stretch`: Scale width and height independently, This may change the aspect ratio of the source image.
|
|
195
|
+
|
|
196
|
+
<Info>NativeMediaView's `aspectRatio` style property is set to `nativeAd.mediaContent.aspectRatio` by default.</Info>
|
|
197
|
+
|
|
198
|
+
```tsx
|
|
199
|
+
const NativeComponent = () => {
|
|
200
|
+
return (
|
|
201
|
+
<NativeAdView nativeAd={nativeAd}>
|
|
202
|
+
<NativeMediaView resizeMode={'contain'} style={{ aspectRatio: 1 }} />
|
|
203
|
+
// Other assets..
|
|
204
|
+
</NativeAdView>
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### AdChoices overlay
|
|
210
|
+
|
|
211
|
+
An AdChoices overlay is added as an ad view by the SDK when a backfill ad is returned.
|
|
212
|
+
If your app uses native ads backfill, leave space in your [preferred corner](/native-ads#adchoices-placements) of your native ad view for the automatically inserted AdChoices logo.
|
|
213
|
+
Also, it's important that the AdChoices overlay is seen, so choose background colors and images appropriately.
|
|
214
|
+
For more information on the overlay's appearance and function, refer to the [programmatic native ads implementation guidelines](https://support.google.com/admob/answer/6329638#adchoices).
|
|
215
|
+
|
|
216
|
+
### Ad attribution for programmatic native ads
|
|
217
|
+
|
|
218
|
+
When displaying programmatic native ads, you must display an ad attribution to denote that the view is an advertisement.
|
|
219
|
+
Learn more in [policy guidelines](https://support.google.com/admob/answer/6329638#ad-attribution).
|
|
220
|
+
|
|
221
|
+
### Code example
|
|
222
|
+
|
|
223
|
+
These are the steps for displaying a native ad:
|
|
224
|
+
|
|
225
|
+
1. Place the `NativeAdView`, register it by setting the `nativeAd` prop to the NativeAd object.
|
|
226
|
+
2. For each ad asset to be displayed:
|
|
227
|
+
- Populate the asset view with the asset in the `NativeAd` object.
|
|
228
|
+
- Register the asset view by wrapping it with the `NativeAsset` component.
|
|
229
|
+
3. Place the `NativeMediaView` inside your native ad layout to display media asset.
|
|
230
|
+
|
|
231
|
+
```tsx
|
|
232
|
+
const NativeComponent = () => {
|
|
233
|
+
const [nativeAd, setNativeAd] = useState<NativeAd>();
|
|
234
|
+
|
|
235
|
+
useEffect(() => {
|
|
236
|
+
NativeAd.createForAdRequest(TestIds.NATIVE)
|
|
237
|
+
.then(setNativeAd)
|
|
238
|
+
.catch(console.error);
|
|
239
|
+
}, []);
|
|
240
|
+
|
|
241
|
+
if (!nativeAd) {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
// Wrap all the ad assets in the NativeAdView component, and register the view with the nativeAd prop
|
|
247
|
+
<NativeAdView nativeAd={nativeAd}>
|
|
248
|
+
// Display the icon asset with Image component, and use NativeAsset to register the view
|
|
249
|
+
{nativeAd.icon && (
|
|
250
|
+
<NativeAsset assetType={NativeAssetType.ICON}>
|
|
251
|
+
<Image source={{uri: nativeAd.icon.url}} width={24} height={24} />
|
|
252
|
+
</NativeAsset>
|
|
253
|
+
)}
|
|
254
|
+
// Display the headline asset with Text component, and use NativeAsset to register the view
|
|
255
|
+
<NativeAsset assetType={NativeAssetType.HEADLINE}>
|
|
256
|
+
<Text style={{fontSize: 18, fontWeight: 'bold'}}>
|
|
257
|
+
{nativeAd.headline}
|
|
258
|
+
</Text>
|
|
259
|
+
</NativeAsset>
|
|
260
|
+
// Always display an ad attribution to denote that the view is an advertisement
|
|
261
|
+
<Text>Sponsored</Text>
|
|
262
|
+
// Display the media asset
|
|
263
|
+
<NativeMediaView />
|
|
264
|
+
// Repeat the process for the other assets in the NativeAd.
|
|
265
|
+
</NativeAdView>
|
|
266
|
+
);
|
|
267
|
+
};
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
## Receiving ad events
|
|
271
|
+
|
|
272
|
+
The `NativeAd` object emits events that you can listen to.
|
|
273
|
+
|
|
274
|
+
Use the `addAdEventListener` method to listen to ad events emitted by the `NativeAd`. Pass one of the `NativeAdEventType` enum values to specify the event type.
|
|
275
|
+
|
|
276
|
+
Check the [NativeAdEventType](https://github.com/invertase/react-native-google-mobile-ads/blob/main/src/NativeAdEventType.ts) source code to see the full range of events available.
|
|
277
|
+
|
|
278
|
+
```tsx
|
|
279
|
+
const NativeComponent = () => {
|
|
280
|
+
const [nativeAd, setNativeAd] = useState<NativeAd>();
|
|
281
|
+
|
|
282
|
+
useEffect(() => {
|
|
283
|
+
NativeAd.createForAdRequest(TestIds.NATIVE)
|
|
284
|
+
.then(setNativeAd)
|
|
285
|
+
.catch(console.error);
|
|
286
|
+
}, []);
|
|
287
|
+
|
|
288
|
+
useEffect(() => {
|
|
289
|
+
if (!nativeAd) return;
|
|
290
|
+
const listener = nativeAd.addAdEventListener(NativeAdEventType.CLICKED, () => {
|
|
291
|
+
console.log('Native ad clicked');
|
|
292
|
+
});
|
|
293
|
+
return () => {
|
|
294
|
+
listener.remove();
|
|
295
|
+
// or
|
|
296
|
+
nativeAd.destroy();
|
|
297
|
+
};
|
|
298
|
+
}, [nativeAd]);
|
|
299
|
+
|
|
300
|
+
if (!nativeAd) {
|
|
301
|
+
return null;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
return (
|
|
305
|
+
<NativeAdView nativeAd={nativeAd}>
|
|
306
|
+
// Components to display assets must be placed here
|
|
307
|
+
</NativeAdView>
|
|
308
|
+
);
|
|
309
|
+
};
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
## Destroying ads
|
|
313
|
+
|
|
314
|
+
Always destroy the `NativeAd` object when it is no longer needed to free up resources.
|
|
315
|
+
|
|
316
|
+
Calling the `destroy` method also removes all event listeners registered on the `NativeAd` object.
|
|
317
|
+
|
|
318
|
+
```tsx
|
|
319
|
+
const NativeComponent = () => {
|
|
320
|
+
const [nativeAd, setNativeAd] = useState<NativeAd>();
|
|
321
|
+
|
|
322
|
+
useEffect(() => {
|
|
323
|
+
NativeAd.createForAdRequest(TestIds.NATIVE)
|
|
324
|
+
.then(setNativeAd)
|
|
325
|
+
.catch(console.error);
|
|
326
|
+
}, []);
|
|
327
|
+
|
|
328
|
+
useEffect(() => {
|
|
329
|
+
if (!nativeAd) return;
|
|
330
|
+
return () => {
|
|
331
|
+
nativeAd.destroy();
|
|
332
|
+
};
|
|
333
|
+
}, [nativeAd]);
|
|
334
|
+
|
|
335
|
+
if (!nativeAd) {
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return (
|
|
340
|
+
<NativeAdView nativeAd={nativeAd}>
|
|
341
|
+
// Components to display assets must be placed here
|
|
342
|
+
</NativeAdView>
|
|
343
|
+
);
|
|
344
|
+
};
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
## Caveats / Limitations
|
|
348
|
+
|
|
349
|
+
### `NativeAsset` placement
|
|
350
|
+
|
|
351
|
+
Place the asset view(such as `Text`, `Image` component) as a direct child of the `NativeAsset` component,
|
|
352
|
+
and do not wrap the asset view with another view.
|
|
353
|
+
The SDK automatically handles tasks such as recording / handling clicks on the asset view.
|
|
354
|
+
Wrapping the asset view with another view can interfere with these tasks.
|
|
355
|
+
|
|
356
|
+
Do:
|
|
357
|
+
```tsx
|
|
358
|
+
<NativeAsset assetType={NativeAssetType.CTA}>
|
|
359
|
+
<Text style={{ padding: 8 }}>{nativeAd.cta}</Text>
|
|
360
|
+
</NativeAsset>
|
|
361
|
+
<NativeAsset assetType={NativeAssetType.ICON}>
|
|
362
|
+
<Image source={{uri: nativeAd.icon.url}} width={24} height={24} style={{ borderRadius: 8 }} />
|
|
363
|
+
</NativeAsset>
|
|
364
|
+
```
|
|
365
|
+
Don't:
|
|
366
|
+
```tsx
|
|
367
|
+
<NativeAsset assetType={NativeAssetType.CTA}>
|
|
368
|
+
<TouchableOpacity style={{ padding: 8 }}>
|
|
369
|
+
<Text>{nativeAd.cta}</Text>
|
|
370
|
+
</TouchableOpacity>
|
|
371
|
+
</NativeAsset>
|
|
372
|
+
<NativeAsset assetType={NativeAssetType.ICON}>
|
|
373
|
+
<View style={{ borderRadius: 8, overflow: 'hidden' }}>
|
|
374
|
+
<Image source={{uri: nativeAd.icon.url}} width={24} height={24} />
|
|
375
|
+
</View>
|
|
376
|
+
</NativeAsset>
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Not implemented features
|
|
380
|
+
|
|
381
|
+
These features are not implemented in the current version:
|
|
382
|
+
- Custom Ad Choices view
|
|
383
|
+
- Custom video playback controls
|
|
384
|
+
- Custom click gestures
|
|
385
|
+
- [Custom native ad formats](https://support.google.com/admanager/answer/6366911)
|
package/docs/testing.mdx
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Testing
|
|
2
|
+
|
|
3
|
+
The React Native Google Mobile Ads library depends on a lot of platform-specific native code which you likely want to mock in your tests.
|
|
4
|
+
|
|
5
|
+
## Testing with Jest
|
|
6
|
+
|
|
7
|
+
This library ships with a Jest setup file that mocks the native code for you.
|
|
8
|
+
To use it, add the following to your Jest configuration:
|
|
9
|
+
|
|
10
|
+
```json
|
|
11
|
+
// jest.config.js|ts|mjs|cjs|json
|
|
12
|
+
{
|
|
13
|
+
"setupFiles": [
|
|
14
|
+
"./node_modules/react-native-google-mobile-ads/jest.setup.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Video ad volume control
|
|
2
|
+
|
|
3
|
+
<Info>
|
|
4
|
+
Video volume controls apply only to Google ads and are not forwarded to mediation networks.
|
|
5
|
+
</Info>
|
|
6
|
+
|
|
7
|
+
If your app has its own volume controls, such as custom music or sound effect volumes, disclosing app volume to the Google Mobile Ads SDK enables video ads to respect app volume settings. This ensures users receive video ads with the expected audio volume.
|
|
8
|
+
|
|
9
|
+
The device volume, controlled through volume buttons or OS-level volume slider, determines the volume for device audio output. However, apps can independently adjust volume levels relative to the device volume to tailor the audio experience.
|
|
10
|
+
|
|
11
|
+
For App Open, Banner, Interstitial, Rewarded, and Rewarded Interstitial ad formats you can report the relative app volume to the Google Mobile Ads SDK by calling the `setAppVolume` function. Valid ad volume values range from `0.0` (silent) to `1.0` (current device volume). Here's an example of how to report the relative app volume to the SDK:
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import MobileAds, { GAMBannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';
|
|
16
|
+
|
|
17
|
+
const adUnitId = __DEV__ ? TestIds.GAM_BANNER : '/xxx/yyyy';
|
|
18
|
+
|
|
19
|
+
function App() {
|
|
20
|
+
MobileAds().setAppVolume(0.5);
|
|
21
|
+
|
|
22
|
+
return <GAMBannerAd unitId={adUnitId} sizes={[BannerAdSize.FULL_BANNER]} />;
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
<Error>
|
|
27
|
+
Lowering your app's audio volume reduces video ad eligibility and might reduce your app's ad revenue. You should only utilize this API if your app provides custom volume controls to the user, and the user's volume is properly reflected in the API.
|
|
28
|
+
</Error>
|
|
29
|
+
|
|
30
|
+
For App Open, Banner, Interstitial, Rewarded, and Rewarded Interstitial ad formats, you can inform the Google Mobile Ads SDK that the app volume has been muted by calling the `setAppMuted` function:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import React from 'react';
|
|
34
|
+
import MobileAds, { GAMBannerAd, BannerAdSize, TestIds } from 'react-native-google-mobile-ads';
|
|
35
|
+
|
|
36
|
+
const adUnitId = __DEV__ ? TestIds.GAM_BANNER : '/xxx/yyyy';
|
|
37
|
+
|
|
38
|
+
function App() {
|
|
39
|
+
MobileAds().setAppMuted(true);
|
|
40
|
+
|
|
41
|
+
return <GAMBannerAd unitId={adUnitId} sizes={[BannerAdSize.FULL_BANNER]} />;
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
By default, `appVolume` is set to 1 (the current device volume) and `appMuted` is set to `NO`.
|
|
46
|
+
|
|
47
|
+
<Error>
|
|
48
|
+
Muting your app reduces video ad eligibility and might reduce your app's ad revenue. You should only utilize this API if your app provides a custom mute control to the user, and the user's mute decision is properly reflected in the API.
|
|
49
|
+
</Error>
|
package/docs.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "React Native Google Mobile Ads",
|
|
3
|
+
"logo": "https://raw.githubusercontent.com/invertase/react-native-google-mobile-ads/main/docs/img/logo_admob_192px.svg",
|
|
4
|
+
"twitter": "invertaseio",
|
|
5
|
+
"sidebar": [
|
|
6
|
+
[
|
|
7
|
+
"Getting Started",
|
|
8
|
+
[
|
|
9
|
+
["Getting Started", "/"],
|
|
10
|
+
["Displaying Ads", "/displaying-ads"],
|
|
11
|
+
["Native Ads", "/native-ads"],
|
|
12
|
+
["Common Reasons For Ads Not Showing", "/common-reasons-for-ads-not-showing"]
|
|
13
|
+
]
|
|
14
|
+
],
|
|
15
|
+
[
|
|
16
|
+
"Advanced Usage",
|
|
17
|
+
[
|
|
18
|
+
["Displaying Ads via Hook", "/displaying-ads-hook"],
|
|
19
|
+
["Mediation", "/mediation"],
|
|
20
|
+
["European User Consent", "/european-user-consent"],
|
|
21
|
+
["Ad Inspector", "/ad-inspector"],
|
|
22
|
+
["Impression-level ad revenue", "/impression-level-ad-revenue"],
|
|
23
|
+
["Video ad volume control", "/video-ad_volume-control"],
|
|
24
|
+
["Testing", "/testing"]
|
|
25
|
+
]
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
"Migration Guides",
|
|
29
|
+
[
|
|
30
|
+
["Migrating to v5", "/migrating-to-v5"],
|
|
31
|
+
["Migrating to v6", "/migrating-to-v6"],
|
|
32
|
+
["Migrating to v15", "/migrating-to-v15"]
|
|
33
|
+
]
|
|
34
|
+
]
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
|
|
22
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
23
|
+
|
|
24
|
+
#import <RNGoogleMobileAdsSpec/RNGoogleMobileAdsSpec.h>
|
|
25
|
+
@interface RNGoogleMobileAdsAppOpenModule : NSObject <NativeAppOpenModuleSpec>
|
|
26
|
+
|
|
27
|
+
#else
|
|
28
|
+
|
|
29
|
+
#import <React/RCTBridgeModule.h>
|
|
30
|
+
@interface RNGoogleMobileAdsAppOpenModule : NSObject <RCTBridgeModule>
|
|
31
|
+
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
@end
|
|
35
|
+
|
|
36
|
+
#endif
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import "RNGoogleMobileAdsAppOpenModule.h"
|
|
21
|
+
#import <GoogleMobileAds/GoogleMobileAds.h>
|
|
22
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
23
|
+
#import "RNGoogleMobileAdsSpec.h"
|
|
24
|
+
#endif
|
|
25
|
+
#import "RNGoogleMobileAdsCommon.h"
|
|
26
|
+
#import "RNGoogleMobileAdsFullScreenAd.h"
|
|
27
|
+
|
|
28
|
+
@interface RNGoogleMobileAdsAppOpenAd : RNGoogleMobileAdsFullScreenAd
|
|
29
|
+
|
|
30
|
+
@end
|
|
31
|
+
|
|
32
|
+
@implementation RNGoogleMobileAdsAppOpenAd
|
|
33
|
+
|
|
34
|
+
- (NSString *)getAdEventName {
|
|
35
|
+
return GOOGLE_MOBILE_ADS_EVENT_APP_OPEN;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (void)loadAd:(NSString *)adUnitId
|
|
39
|
+
adRequest:(GAMRequest *)adRequest
|
|
40
|
+
completionHandler:
|
|
41
|
+
(void (^)(GADAppOpenAd *_Nullable ad, NSError *_Nullable error))completionHandler {
|
|
42
|
+
[GADAppOpenAd loadWithAdUnitID:adUnitId request:adRequest completionHandler:completionHandler];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@end
|
|
46
|
+
|
|
47
|
+
@implementation RNGoogleMobileAdsAppOpenModule {
|
|
48
|
+
RNGoogleMobileAdsAppOpenAd *_ad;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
RCT_EXPORT_MODULE();
|
|
52
|
+
|
|
53
|
+
- (dispatch_queue_t)methodQueue {
|
|
54
|
+
return dispatch_get_main_queue();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
58
|
+
return YES;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
RCT_EXPORT_METHOD(appOpenLoad
|
|
62
|
+
: (double)requestId adUnitId
|
|
63
|
+
: (NSString *)adUnitId requestOptions
|
|
64
|
+
: (NSDictionary *)requestOptions) {
|
|
65
|
+
[_ad loadWithRequestId:requestId adUnitId:adUnitId adRequestOptions:requestOptions];
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
RCT_EXPORT_METHOD(appOpenShow
|
|
69
|
+
: (double)requestId adUnitId
|
|
70
|
+
: (NSString *)adUnitId showOptions
|
|
71
|
+
: (NSDictionary *)showOptions resolve
|
|
72
|
+
: (RCTPromiseResolveBlock)resolve reject
|
|
73
|
+
: (RCTPromiseRejectBlock)reject) {
|
|
74
|
+
[_ad showWithRequestId:requestId
|
|
75
|
+
adUnitId:adUnitId
|
|
76
|
+
showOptions:showOptions
|
|
77
|
+
resolve:resolve
|
|
78
|
+
reject:reject];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
RCT_EXPORT_METHOD(invalidate) { [_ad invalidate]; }
|
|
82
|
+
|
|
83
|
+
#ifdef RCT_NEW_ARCH_ENABLED
|
|
84
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
85
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params {
|
|
86
|
+
return std::make_shared<facebook::react::NativeAppOpenModuleSpecJSI>(params);
|
|
87
|
+
}
|
|
88
|
+
#endif
|
|
89
|
+
|
|
90
|
+
- (instancetype)init {
|
|
91
|
+
self = [super init];
|
|
92
|
+
if (self) {
|
|
93
|
+
_ad = [[RNGoogleMobileAdsAppOpenAd alloc] init];
|
|
94
|
+
}
|
|
95
|
+
return self;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
- (void)dealloc {
|
|
99
|
+
[self invalidate];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@end
|
|
103
|
+
|
|
104
|
+
#endif
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2016-present Invertase Limited & Contributors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this library except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
#if !TARGET_OS_MACCATALYST
|
|
19
|
+
|
|
20
|
+
#import <GoogleMobileAds/GADAppEventDelegate.h>
|
|
21
|
+
#import <GoogleMobileAds/GADBannerView.h>
|
|
22
|
+
#import <GoogleMobileAds/GADBannerViewDelegate.h>
|
|
23
|
+
#import <React/RCTView.h>
|
|
24
|
+
|
|
25
|
+
@interface RNGoogleMobileAdsBannerComponent : RCTView <GADBannerViewDelegate, GADAppEventDelegate>
|
|
26
|
+
|
|
27
|
+
@property GADBannerView *banner;
|
|
28
|
+
@property(nonatomic, assign) BOOL requested;
|
|
29
|
+
|
|
30
|
+
@property(nonatomic, copy) NSDictionary *sizeConfig;
|
|
31
|
+
@property(nonatomic, copy) NSString *unitId;
|
|
32
|
+
@property(nonatomic, copy) NSDictionary *request;
|
|
33
|
+
@property(nonatomic, copy) NSNumber *manualImpressionsEnabled;
|
|
34
|
+
@property(nonatomic, assign) BOOL propsChanged;
|
|
35
|
+
|
|
36
|
+
@property(nonatomic, copy) RCTBubblingEventBlock onNativeEvent;
|
|
37
|
+
|
|
38
|
+
- (void)requestAd;
|
|
39
|
+
- (void)load;
|
|
40
|
+
- (void)recordManualImpression;
|
|
41
|
+
|
|
42
|
+
@end
|
|
43
|
+
|
|
44
|
+
#endif
|