简体   繁体   中英

Add ads admob in React-native

I am using expo to debug an application. In debug mode ( expo start ) advertising is correctly displayed

on when I build the application ( expo build: android ) advertising is not displayed

when using the test key, the advertisement works correctly in apk

checked the key. google admob it's active

Do I need to make some settings to display admob ads

I watched the documentation there described only about inserting the code into the program. I use the library expo-ads-admob

<View style = {{ width: '100%', alignItems: 'center' }}>
        <AdMobBanner
            bannerSize="fullBanner"
            adUnitID="ca-app-pub-3940256099942544/6300978111"
            testDeviceID="EMULATOR" />
        <TouchableHighlight onPress={() =>{this.props.navigation.navigate('SearchObjectPage');} style={{
           marginTop: 30,
           width: '90%',
           padding: 10, 
           backgroundColor: '#a1cfed',
         }}>
        <View>
          <View style={{flexDirection:'row'}}>
            <Image source={require('./src/red.png')} style={ styles.button } resizeMode="contain"/><Text style = { styles.text }>{'check'}</Text>
          </View>
        </View>
        </TouchableHighlight>
</View>

For simulators/emulators you can use EMULATOR for the test device ID.

However, if you create an apk, the divice will not run because it is not an emulator.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM