xamarin / XamarinComponents

Plugins for Xamarin
MIT License
1.99k stars 691 forks source link

Collect consent of European users GDPR - User Messaging Platform (UMP) SDK #931

Closed Sergtek closed 3 years ago

Sergtek commented 4 years ago

Describe your Issue

Important: Google is planning to launch its full support of the IAB TCFv2 for GDPR on August 15, 2020. We are releasing the Funding Choices IAB solution early to ensure you have adequate time to set up and test your consent messages on your apps prior to this launch. Prior to August 15, publishers should not publish consent messages using the IAB framework to apps with live traffic.

The Xamarin.Forms team plans to implement the User Messaging Platform SDK so that developers can comply with the new European regulation? I think this should be a priority issue on the roadmap.

Relevant information

moljac commented 4 years ago

@nacompllo

Thanks for feedback, but I need more info and first of all this is not Xamarin.Forms repo.

Second question:

The Xamarin.Forms team plans to implement the User Messaging Platform SDK so that developers can comply with the new European regulation?

Is this a statement or question?

UMP is completely new artifact groupId namely com.google.android.ump from:

implementation 'com.google.android.ump:user-messaging-platform:1.0.0'

And this repo binds only Android artifacts from following groups:

*. com.google.android.gms

*. com.google.firebase

moljac commented 4 years ago

Bottom line: I'm not sure if I'll be able to bind both Android and iOS. I might do Android in my spare time, but I cannot promise.

Sergtek commented 4 years ago

Thanks for feedback, but I need more info and first of all this is not Xamarin.Forms repo.

Hi, I leave you information about it:

EU user consent policy

The European Union in the coming days will require developers to add a banner to applications to control the following:

For Google products used on any site, app or other property that is under your control, or that of your affiliate or your client, the following duties apply for end users in the European Economic Area along with the UK.

You must obtain end users’ legally valid consent to:

the use of cookies or other local storage where legally required; and
the collection, sharing, and use of personal data for personalization of ads.

When seeking consent you must:

retain records of consent given by end users; and
provide end users with clear instructions for revocation of consent.

You must clearly identify each party that may collect, receive, or use end users’ personal data as a consequence of your use of a Google product. You must also provide end users with prominent and easily accessible information about that party’s use of end users’ personal data.

To control these cases Google has released the UMP SDK which would be great if Xamarin.Forms implemented it as a component to be able to use it.

Funding Choices Google has integrated in AdMob the Financing Options.

Funding Choices is an easy-to-use messaging tool that can help you comply with the EU General Data Protection Regulation (GDPR). Official site: https://fundingchoices.google.com/ Create an app message for EU consent with Funding Choices

Example of how it should look:

Second question:

The Xamarin.Forms team plans to implement the User Messaging Platform SDK so that developers can comply with the new European regulation?

Is this a statement or question?

It is a question since I think it would be interesting to implement this.

UMP is completely new artifact groupId namely com.google.android.ump from:

implementation 'com.google.android.ump:user-messaging-platform:1.0.0'

And this repo binds only Android artifacts from following groups:

*. com.google.android.gms

*. com.google.firebase

Ok, I wasn't quite sure where I should post this request, thanks for transferring the thread to XamarinComponents, you're right UMP being a new artifact makes more sense than this in this repository.

I think that with the links that I have left to the UMP SDK documentation and the EU user consent policy there is a lot of information about it, if you need more information, please leave a comment and I will try to provide as much as possible . Thank you.

moljac commented 4 years ago

https://www.nuget.org/packages/Xamarin.Google.UserlMessagingPlatform/1.0.0-preview01

https://github.com/xamarin/XamarinComponents/pull/935

moljac commented 3 years ago

Published

https://www.nuget.org/packages/Xamarin.Google.UserMessagingPlatform/

Note:

There was typo in initial bindings (link above)

https://www.nuget.org/packages/Xamarin.Google.UserlMessagingPlatform/1.0.0-preview01

https://www.nuget.org/packages/Xamarin.Google.UserlMessagingPlatform/

FANMixco commented 3 years ago

Is there any example of how to use it? The one from Google seems in its barebones and that something is missing.

Sergtek commented 3 years ago

Is there any example of how to use it? The one from Google seems in its barebones and that something is missing.

Here is a repository that shows how to use this library: https://github.com/GalaxiaGuy/GoogleUserMessagingPlatform

FANMixco commented 2 years ago

I created a full tutorial also for Android:

https://supernovaic.blogspot.com/2022/02/guide-for-using-xamaringoogleusermessag.html

mikeks commented 1 year ago

I was able to implement AdMob GDPR Message on Xamarin Forms apps using Xamarin.Google.UserMessagingPlatform NuGet. But I have problems with porting the same to iOS. I was able to add Xamarin.Google.iOS.UserMessagingPlatform NuGet, but then I can't figure out what Namespaces should I use in C# code. If I use the same namespace as for Android (Xamarin.Google.UserMesssagingPlatform), then I see all classes available but missing references to Mono.Android, which should not be required for iOS Project obviously. My guess that I should use a different namespace, but I really can't locate it anywhere. What namespace/classes is declared in Xamarin.Google.iOS.UserMessagingPlatform NuGet, there's no debug information anywhere, or instructions/examples. Could you help?

mikeks commented 1 year ago

I created a full tutorial also:

https://supernovaic.blogspot.com/2022/02/guide-for-using-xamaringoogleusermessag.html

This is a great tutorial, but this is for Android. For iOS I can't even understand which namespace to use and where all the classes declared. I imported Xamarin.Google.iOS.UserMessagingPlatform nuget, but that's it, can't go any further.

FANMixco commented 1 year ago

I created a full tutorial also: https://supernovaic.blogspot.com/2022/02/guide-for-using-xamaringoogleusermessag.html

This is a great tutorial, but this is for Android. For iOS I can't even understand which namespace to use and where all the classes declared. I imported Xamarin.Google.iOS.UserMessagingPlatform nuget, but that's it, can't go any further.

Have you created a new ticket for iOS? I think it will be easier to get their attention. The iOS version is old (10/20/2020) while the Android one is just two months old: https://www.nuget.org/packages/Xamarin.Google.iOS.UserMessagingPlatform

Any thoughts @moljac where this ticket can be raised? It is an official Microsoft/Xamarin Package:

image

FANMixco commented 1 year ago

Bing Chat provided me this answer:

Thank you for clarifying your question. UserMessagingPlatform is a library that helps you display GDPR consent messages to your app users in the European Economic Area (EEA) or the UK¹. It is part of the Google Mobile Ads SDK and works with AdMob and other Google advertising products².

To use UserMessagingPlatform in your iOS app, you need to follow these steps:

Here is an example of how to use UserMessagingPlatform in your iOS app:

using Google.MobileAds;
using Google.MobileAds.Consent;
using UIKit;

namespace MyApp
{
    public class AppDelegate : UIApplicationDelegate
    {
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Initialize Google Mobile Ads SDK
            MobileAds.SharedInstance.Start(null);

            // Request consent information
            ConsentInformation.SharedInstance.RequestConsentInfoUpdate(new string[] { "pub-0[1](https://cookieinformation.com/resources/blog/is-your-mobile-app-gdpr-compliant/)[2](https://www.appknox.com/resources/guides/make-your-mobile-app-compliant-to-gdpr)[3](https://support.google.com/admob/answer/10113207?hl=en)[4](https://stackoverflow.com/questions/50486708/how-to-add-gdpr-consent-dialog-in-app-and-gdpr-related-confusions)56789012345" }, (error) =>
            {
                if (error == null)
                {
                    // Check user location
                    if (ConsentInformation.SharedInstance.IsRequestLocationInEeaOrUnknown)
                    {
                        // Load consent message
                        ConsentForm consentForm = new ConsentForm();
                        consentForm.Load((loadError) =>
                        {
                            if (loadError == null)
                            {
                                // Show consent message
                                consentForm.Show((dismissError, userPrefersAdFree) =>
                                {
                                    if (dismissError == null)
                                    {
                                        // Handle user choice
                                        switch (ConsentInformation.SharedInstance.ConsentStatus)
                                        {
                                            case ConsentStatus.NonPersonalized:
                                                // Show non-personalized ads
                                                break;
                                            case ConsentStatus.Personalized:
                                                // Show personalized ads
                                                break;
                                            default:
                                                // No consent given, do not show ads
                                                break;
                                        }
                                    }
                                });
                            }
                        });
                    }
                }
            });

            return true;
        }
    }
}

I hope this helps you with your app development. If you have any other questions, please feel free to ask. 😊

Source: Conversation with Bing, 9/18/2023 (1) GDPR compliance for mobile apps: A checklist in 7 steps. https://cookieinformation.com/resources/blog/is-your-mobile-app-gdpr-compliant/. (2) Guide: Make Your Mobile App Compliant to GDPR - Appknox. https://www.appknox.com/resources/guides/make-your-mobile-app-compliant-to-gdpr. (3) Create GDPR messages for apps - Google AdMob Help. https://support.google.com/admob/answer/10113207?hl=en. (4) How to add GDPR consent dialog in app and GDPR related confusions. https://stackoverflow.com/questions/50486708/how-to-add-gdpr-consent-dialog-in-app-and-gdpr-related-confusions.

But I'm not so sure if it will work as expected, you can try it, @mikeks, but most likely you will face another issue since the Official Microsoft lib is outdated.

BenEastpoint commented 1 year ago

@moljac do you know if there is any plan to implement an iOS version which supports .NET MAUI applications (I'm using .NET 7)? Whether that be an update to Xamarin.Google.UserMessagingPlatform to include support for iOS or an update to Xamarin.Google.iOS.UserMessagingPlatform. I've tried to use Xamarin.Google.iOS.UserMessagingPlatform, but it doesn't seem to contain the namespaces that are required.

emiliobongiorno commented 8 months ago

Is there any update on implementing an iOS version for .NET MAUI applications? This is very important for developers that need to use Admob on iOS using MAUI since the new RGPD requirements for user concent. Is a blocking issue since January 16 2024, and I can't find any solution for iOS yet.

mikeks commented 8 months ago

Bing Chat provided me this answer of how use it, but I'm not sure it's workable. @mikeks would be a better tester than me.

The code from Bing Chat is outdated, but I was able to compile it with some changes. I didn't test it yet, I will update this when I test the code.

Corrected code:

            var requestParameters = new RequestParameters();
            requestParameters.TagForUnderAgeOfConsent = false;

#if DEBUG
            requestParameters.DebugSettings = new DebugSettings
            {
                Geography = DebugGeography.Eea
            };
#endif

            ConsentInformation.SharedInstance.RequestConsentInfoUpdate(requestParameters, (error) =>
            {
                if (error == null)
                {
                    consentStatus = ConsentInformation.SharedInstance.ConsentStatus;
                    // Check user location
                    if (consentStatus == ConsentStatus.Unknown
                    || consentStatus == ConsentStatus.Required) // IsRequestLocationInEeaOrUnknown
                    {
                        // Load consent message
                                                ConsentForm.Load((consentForm, loadError) =>
                                                {
                                                    if (loadError == null)
                                                    {
                                                        // Show consent message
                                                        consentForm.Present(viewController);
                                                    }
                                                });
                    }
                }
            });