Additional Google AdMob steps - cleveradssolutions/CAS-Android GitHub Wiki
CAS assigns a new AdMob App ID for your application to the correct operation of all features.
Important
You cannot use your own identifier and must replace it with a new one generated by CAS system.
You can find your Admob App ID in the CAS UI:
- Click the Show AdMob App ID button.
- Copy the id from the form.
- Add a
<meta-data>
tag withandroid:name="com.google.android.gms.ads.APPLICATION_ID"
in your app'sAndroidManifest.xml
file. - Insert AdMob app ID to
android:value
, surrounded by quotation marks, as shown below.
<manifest>
<application>
...
<!-- Sample AdMob App ID: ca-app-pub-3940256099942544~3347511713 -->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy"/>
</application>
</manifest>
Note that failure to add the <meta-data>
tag as shown above results in a crash with the message:
The Google Mobile Ads SDK was initialized incorrectly.
If your app has special requirements, you can set the optional SharedPreferences gad_has_consent_for_cookies
.
The Google Mobile Ads SDK will enable limited ads (LTD) when the gad_has_consent_for_cookies
preference is set to zero.
SharedPreferences sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(context);
sharedPreferences.edit().putInt("gad_has_consent_for_cookies", 0).apply();