React native AdMobBanner的'testDeviceID'属性已弃用。测试设备ID现在是全局设置的。改用AdMob.setTestDeviceIDAsync
我最近一直在制作一款真正本土的应用程序。我还用谷歌的admob放了一条广告横幅,直到几天前才有广告出现。 设置下面的admob道具将导致错误React native AdMobBanner的'testDeviceID'属性已弃用。测试设备ID现在是全局设置的。改用AdMob.setTestDeviceIDAsync,react-native,admob,expo,React Native,Admob,Expo,我最近一直在制作一款真正本土的应用程序。我还用谷歌的admob放了一条广告横幅,直到几天前才有广告出现。 设置下面的admob道具将导致错误 <AdMobBanner bannerSize="banner" adUnitID="ca-app-pub-@@@@@@@" testDeviceID="EMULATOR" servePersonalizedAds = {true} onDidFailToReceiveAdWithError={this.ba
<AdMobBanner
bannerSize="banner"
adUnitID="ca-app-pub-@@@@@@@"
testDeviceID="EMULATOR"
servePersonalizedAds = {true}
onDidFailToReceiveAdWithError={this.bannerError}
/>
如果您能帮助我,我将不胜感激。我也有同样的问题,他们应该更新世博会网站上的信息。我相信这也应该适用于旗帜 进口:
import {
setTestDeviceIDAsync, //<--- I forgot this first time
AdMobInterstitial
}from 'expo-ads-admob';
通过按钮或任何您喜欢的方式触发此功能:
_openInterstitial = async () => {
try {
this.setState({ disableInterstitialBtn: true })
await AdMobInterstitial.requestAdAsync()
await AdMobInterstitial.showAdAsync()
} catch (error) {
console.error(error)
} finally {
this.setState({ disableInterstitialBtn: false })
}
}
你好我只是想澄清一下,因为我在文件上看不到它。一旦我将为制作/播放商店构建应用程序,我是否需要删除/替换
setTestDeviceIDAsync
?如果是的话,你会怎么做?
componentDidMount(){
this.initAds().catch((error) => console.log(error));
}
initAds = async () => {
AdMobInterstitial.setAdUnitID('ca-app-pub-3940256099942544/1033173712') //test id
await setTestDeviceIDAsync('EMULATOR');
}
_openInterstitial = async () => {
try {
this.setState({ disableInterstitialBtn: true })
await AdMobInterstitial.requestAdAsync()
await AdMobInterstitial.showAdAsync()
} catch (error) {
console.error(error)
} finally {
this.setState({ disableInterstitialBtn: false })
}
}