reactjs react-native-google-mobile-ads年龄限制

2j4z5cfb  于 2023-05-17  发布在  React
关注(0)|答案(1)|浏览(166)

我已经使用react-native构建了一个应用程序,我正在使用:react-native-google-mobile-ads and im trying to show ads that are only familey friendly.如何在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>
  );
}

试着搜索文档

z9smfwbn

z9smfwbn1#

import {MaxAdContentRating,} from "react-native-google-mobile-ads";

1.将此添加到requestOptions

maxAdContentRating: MaxAdContentRating.PG,
tagForChildDirectedTreatment: true,
tagForUnderAgeOfConsent: true

相关问题