I am in the final stages of setting up my Android App using Xamarin / C#. I have implemented Google Admob but GDPR rules say that I must have a privacy notice to display ads. Google's documentation says that the Consent SDK is deprecated and that I should use the new User Messaging Platform https://developers.google.com/admob/ump/android/quick-start
I have downloaded the Nuget package Xamarin.Google.UserMessagingPlatform (https://www.nuget.org/packages/Xamarin.Google.UserMessagingPlatform/1.0.0?_src=template) and have imported the libraries but I am struggling to translate Google's code to my project and having searched online there does not appear to be a live documentation link anywhere with examples of implementation in C# / Xamarin. The project site on the package URL 404s and the source repository leads to the general Xamarin repository but I couldn't find a reference to UMP in there.
Specifically, one statement I do not know how to handle is this:
new ConsentInformation.OnConsentInfoUpdateSuccessListener() {
@Override
public void onConsentInfoUpdateSuccess() {
// The consent information state was updated.
// You are now ready to check if a form is available.
}
},
new ConsentInformation.OnConsentInfoUpdateFailureListener() {
@Override
public void onConsentInfoUpdateFailure(FormError formError) {
// Handle the error.
}
Are there any examples of the implementation in C#?
I wrote this full tutorial in my blog (for Android only), but here you have it:
AdMob Section
Go to your AdMob account.
Go to Privacy & Messaging and choose the phone icon.
C# Section
Download the Xamarin.Google.UserMessagingPlatform from NuGet.
Double-check that your AndroidManifest.xml has these two lines:
You can get AD_UNIT_ID and APP_ID from your AdMob account:
And that's all!