Skip to main content

setRequestConfiguration

setRequestConfiguration is a function that configures Ad requests and initializes Mobile Ads SDK. You need to call this function before you load any Ads. Generally, you call this function when the root component of your app is mounted.

setRequestConfiguration returns Promise<MediationAdapterStatus[]> which is each mediation adapter's initialization status.

Properties​

NameTypeRequired
testDeviceIdsArray<string>no
maxAdContentRatingAd Content Ratingsno
tagForChildDirectedTreatmentbooleanno
tagForUnderAgeConsentbooleanno
trackingAuthorizedbooleanno

trackingAuthorized​

If you are building for iOS 14 or later, Facebook requires that you explicitly set their Advertising Tracking Enabled flag. Use react-native-tracking-transparency to acquire permission status for tracking, and pass it to trackingAuthorized property.

Ad Content Ratings​

TypeDescription
G"General audiences." Content suitable for all audiences, including families and children.
MA"Mature audiences." Content suitable only for mature audiences; includes topics such as alcohol, gambling, sexual content, and weapons.
PG"Parental guidance." Content suitable for most audiences with parental guidance, including topics like non-realistic, cartoonish violence.
T"Teen." Content suitable for teen and older audiences, including topics such as general health, social networks, scary imagery, and fight sports.
UNSPECIFIEDSet default value to ""

MediationAdapterStatus​

NameType
namestring
descriptionstring
stateAdapterState

AdapterState​

enum AdapterState { NOT_READY, READY }

Usage example​

const config = {
testDeviceIds: ["YOUR_TEST_DEVICE_ID"],
maxAdContetRating: "MA",
tagForChildDirectedTreatment: false,
tagForUnderAgeConsent: false,
};

export default function App() {
const [loading, setLoading] = useState(true);

useEffect(() => {
const init = async () => {
const trackingStatus = await requestTrackingPermission();

let trackingAuthorized = false;
if (trackingStatus === "authorized" || trackingStatus === "unavailable") {
trackingAuthorized = true;
}

await AdManager.setRequestConfiguration({
...config,
trackingAuthorized,
});

setLoading(false);
};

init();
}, []);

return (/* Your App code */)