ExzileGames.AndroidConsentBridge 1.0.25

dotnet add package ExzileGames.AndroidConsentBridge --version 1.0.25
                    
NuGet\Install-Package ExzileGames.AndroidConsentBridge -Version 1.0.25
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ExzileGames.AndroidConsentBridge" Version="1.0.25" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ExzileGames.AndroidConsentBridge" Version="1.0.25" />
                    
Directory.Packages.props
<PackageReference Include="ExzileGames.AndroidConsentBridge" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ExzileGames.AndroidConsentBridge --version 1.0.25
                    
#r "nuget: ExzileGames.AndroidConsentBridge, 1.0.25"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ExzileGames.AndroidConsentBridge@1.0.25
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ExzileGames.AndroidConsentBridge&version=1.0.25
                    
Install as a Cake Addin
#tool nuget:?package=ExzileGames.AndroidConsentBridge&version=1.0.25
                    
Install as a Cake Tool

AndroidConsentBridge

A Java bridge + C# interop library for Google's User Messaging Platform (UMP) v3 on .NET Android. Collects GDPR and CCPA consent before any ads are shown. Must be called at app startup — before initializing AndroidAdsBridge or requesting any ad.

Problem

The Xamarin.Google.UserMessagingPlatform NuGet binding exposes the UMP SDK but requires wiring up Java ConsentInformation and form callbacks manually from C#. The binding's async surface returns Task<Java.Lang.Object> in several places, and errors from the UMP SDK (network errors, form load failures) are surfaced as raw Java exceptions that are hard to handle gracefully.

Solution

A compiled Java bridge class manages the ConsentInformation.requestConsentInfoUpdate → form load → form show lifecycle. It returns structured results to C# with error codes and messages, all without requiring any Java callback wiring in your application code.

APIs Exposed

Method Description
RequestConsentInfoUpdateAsync(bool underAgeOfConsent, bool debugReset) Fetches current consent status from UMP servers. Pass debugReset: true during testing to force the form to appear.
LoadAndShowConsentFormIfRequiredAsync() Shows the consent form if consent is required. No-op when not in a regulated region.
CanRequestAds true when it is safe to initialize AdMob and request ads.
GetConsentStatus() Returns Unknown, Required, NotRequired, or Obtained.
Reset() Resets consent state. Debug/testing only — do not call in production.

Setup

1. Add NuGet package

dotnet add package ExzileGames.AndroidConsentBridge

2. Initialize in your Activity

using AndroidConsentBridge.Interop;

protected override void OnCreate(Bundle? savedInstanceState)
{
    base.OnCreate(savedInstanceState);
    ConsentBridgeManager.SetImplementation(new AndroidConsentBridgeImpl(this));
}
using AndroidConsentBridge.Interop;

// Request consent status from UMP servers
var update = await ConsentBridgeManager.RequestConsentInfoUpdateAsync(
    tagForUnderAgeOfConsent: false,
    debugReset: false);

if (update.Success)
{
    // Show the form if required (no-op outside regulated regions)
    var form = await ConsentBridgeManager.LoadAndShowConsentFormIfRequiredAsync();

    if (form.CanRequestAds)
    {
        // Safe to initialize and load ads now
        AdsBridgeManager.SetImplementation(new AndroidAdsBridgeImpl(this));
        AdsBridgeManager.LoadRewardedAd(adUnitId);
    }
}

Notes

  • Always call RequestConsentInfoUpdateAsync and LoadAndShowConsentFormIfRequiredAsync before initializing AndroidAdsBridge. Showing ads without collecting consent in regulated regions violates Google's policies.
  • Use debugReset: true during development to force the consent form to appear regardless of region.
  • CanRequestAds returns true both when consent has been obtained and when the user is not in a regulated region.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-android36.0 is compatible.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.25 170 4/9/2026
1.0.24 102 4/9/2026