Implementing Google Consent for GDPR with React Native

Tiempo de lectura: < 1 minuto

Today we are going to learn how we can implement the GDPR consent message with React Native.

Lets install the following library (https://www.npmjs.com/package/@ulangi/react-native-ad-consent)

npm install @ulangi/react-native-ad-consent --save

<p.Now let’s add this key in info.plist of iOS:

<p.Now we open AndroidManifest.xml in case of Android. And add:

And now we create our component called consentAdmob.ts

To use the functions we provide, you should call obtenerConsentimientoUsuario before showing the consent form and initializing AdMob with the function mostrarAlertAdmobConsent. Make sure to provide the proper values for adAppId and publisherId. Also, remember to add: «https://your-privacy-link.com» for your app’s privacy policy URL.

Here’s an example of how you could use these functions:

Leave a Comment