Today we are going to learn how we can add the mandatory ad consent message to comply with GDPR.

The first thing we need to do is to have our message set up: https://devcodelight.com/mensaje-consentimiento-conforme-rgpd-para-admob/
NOTE: I am using version 12.2.0 of react-native-google-mobile-ads at least (https://github.com/invertase/react-native-google-mobile-ads)
Once configured, let’s go to android/app/proguard-rules.pro and add:
-keep class com.google.android.gms.internal.consent_sdk.** { *; }
Now we need to go to our app.json of Expo to add:
In my case I have to add it to the rest of the attributes I use:

Now we need to activate delay_app_measurement_init when starting the ads so we go to the configuration of «react-native-google-mobile-ads» inside app.json:
Now we have to rebuild the APP:
npx expo prebuild
And now let’s create the component that will allow us to generate the alert:
UserConsent.js
And to use it we will do the following:
<
p Lets go to our home screen and add this component:
<AdsUserConsent/>
To make it work correctly, we must rebuild a development build, we can use this command locally:
or remotely with Expo:
And now the following message should appear:

