Using Xamarin.Google.UserMessagingPlatform with MAUI for presenting a GDPR consent message

Costas Athan 46 Reputation points
2024-07-25T08:45:20.6933333+00:00

I am trying to present a GDPR consent message in a MAUI app using the Xamarin.Google.UserMessagingPlatform NuGet package.

I'm targeting Android 34 on .NET 8.

I have used both this: https://stackoverflow.com/a/71299843/7360423 and this: https://stackoverflow.com/a/69398471/7360423 suggested implementations, but nothing shows up. I get no errors, but also I don't get the expected consent message.

Has anyone succeeded presenting the GDPR consent message with MAUI? Is a different approach needed?

Developer technologies | .NET | .NET MAUI
Developer technologies | C#
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 50,126 Reputation points Microsoft External Staff
    2024-07-30T03:01:31.49+00:00

    Hello,

    Activity has changed to Microsoft.Maui.ApplicationModel.Platform.CurrentActivity for MAUI and to Xamarin.Essentials.Platform.CurrentActivity for Xamarin.Forms.

    Actually, if you are using this method in MainActivity, you don't need to call the global Context and Activity. You could use this keyword instead of these two classes for testing.

    Based on the information you provided, the second answer in the first link has already demonstrated this.

    
    consentInformation.RequestConsentInfoUpdate(
    
                    this,
    
                    requestParameters,
    
    

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.