AdMob: AdMobInterstitial.setTestDeviceID is deprecated
See original GitHub issue🐛 Bug Report
Environment
Bare React Native App using RN 0.61.5
App target: iOS and Android Emulator
Steps to Reproduce
Install and configure AdMob as described in the docs. Run app on Emulator (iOS or Android).
For me it looks like this:
const INTERSTITIAL = Platform.OS === 'ios' ? AD_MOB_IOS : AD_MOB_ANDROID
AdMobInterstitial.setAdUnitID(INTERSTITIAL)
AdMobInterstitial.setTestDeviceID('EMULATOR')
await AdMobInterstitial.requestAdAsync({ servePersonalizedAds: false })
await AdMobInterstitial.showAdAsync()
Expected Behavior
Works without deprecation warnings
Actual Behavior
AdMobInterstitial.setTestDeviceID is deprecated. Test device IDs are now set globally. Use AdMob.setTestDeviceIDAsync instead.
When I use AdMob.setTestDeviceIDAsync I get an error.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Android Admob InterstitialAd Deprecated - Stack Overflow
after a quick search, I found that we need to use public abstract class InterstitialAd extends Object. instead of
Read more >Deprecation and sunset | Android - Google Developers
With the release of a new major Google Mobile Ads SDK version, a deprecated major version may be given a sunset date, after...
Read more >bamlab-react-native-admob - npm
A react-native component for Google AdMob banners and interstitials. Latest version: 1.4.0, last published: 5 years ago.
Read more >expo-permissions is now deprecated - You.com - You.com
React Native expo-permission deprecated what to use now? ... setTestDeviceID('EMULATOR') await AdMobInterstitial. ... When I use AdMob.
Read more >Admob - Expo Documentation
Admob. Deprecated. This module will be removed in SDK 46. There will be no replacement that works with ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

it seems something has gone wrong with the documentation, and the latest
AdMobpage doesn’t show the correct API instructions. I fixed it but it will take a bit for it to show up on the website. This page describes the correct API usage: https://docs.expo.io/versions/v36.0.0/sdk/admob/The problem you are experiencing is because of the import.
setTestDeviceIDAsyncis not defined on the default export, and you need to import it like this:this is how i add banner easy 😊
in app.js
in app.json