2

I've built an app using react-native and i'm using: react-native-google-mobile-ads and im trying to show ads that are only familey friendly. how can i do this in react native?

import { View } from "react-native";
import {
  BannerAd,
  BannerAdSize,
  TestIds,
} from "react-native-google-mobile-ads";

const adUnitId = __DEV__
  ? TestIds.BANNER
  : "ca-app-pub-8453281779869033/5007999033";

export default function BottomBanner() {
  return (
    <View style={{ justifyContent: "center", alignItems: "center" }}>
      <BannerAd
        style={{ width: "100%", height: 100 }}
        unitId={adUnitId}
        size={BannerAdSize.FULL_BANNER}
        requestOptions={{
          requestNonPersonalizedAdsOnly: true,
        }}
      />
    </View>
  );
}

tried searching the docs

Arctodus
  • 5,743
  • 3
  • 32
  • 44
gulliver
  • 21
  • 1
  • I am using the same code my app is in production and the ads working fine till last week but now all of a sudden it stopped working I did not change anything there is no error when I run the app in development and also ad console is working fine. can you help me what can be the reason – Ibad Ur Rehman Jun 08 '23 at 09:45

1 Answers1

0
  1. import {MaxAdContentRating,} from "react-native-google-mobile-ads";
    
  2. Add this to your requestOptions:

    maxAdContentRating: MaxAdContentRating.PG,
    tagForChildDirectedTreatment: true,
    tagForUnderAgeOfConsent: true
    
user16217248
  • 3,119
  • 19
  • 19
  • 37
gulliver
  • 21
  • 1
  • I am using the same code my app is in production and the ads working fine till last week but now all of a sudden it stopped working I did not change anything there is no error when I run the app in development and also ad console is working fine. can you help me what can be the reason – Ibad Ur Rehman Jun 08 '23 at 09:45
  • Where did you find this information? I struggled a lot searching for it – A-wels Jul 13 '23 at 10:47