Table of Contents

Class AdMobConsentProvider

Namespace
VpnHood.AppLib.Ads.AdMob.Android
Assembly
VpnHood.AppLib.Ads.AdMob.Android.dll

Provides AdMob's consent, through Google's User Messaging Platform: its form before an ad's timed load, whether an ad may be preloaded without the form, and the privacy settings' way back to the answer.

public class AdMobConsentProvider : IAdConsentProvider
Inheritance
AdMobConsentProvider
Implements
Inherited Members

Remarks

AdMob's ads also gather the consent by themselves before they load.

Properties

IsPrivacyOptionsRequired

Gets a value indicating whether the person was asked, so they must be able to change their answer.

public bool IsPrivacyOptionsRequired { get; }

Property Value

bool

Remarks

It is true where the person answered a form Google requires a way back to.

Methods

CanRequestAds(IUiContext, CancellationToken)

Gets whether ads may be asked for now, as the network says.

public Task<bool> CanRequestAds(IUiContext uiContext, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The app's UI context.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<bool>

A task whose result is true where the person has answered, or no answer is due where they are; where the network cannot be reached, its last answer stands.

Remarks

It makes sure of the consent information's first update, which it tries again after a failure, logging it, and reads the answer as it stands.

Exceptions

OperationCanceledException

cancellationToken was canceled.

GatherConsent(IUiContext, CancellationToken)

Shows the network's form, where one is due and not answered yet.

public Task GatherConsent(IUiContext uiContext, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The app's UI context.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that completes once the gathering has ended: the form answered, none due, or a failure.

Remarks

A failure is left to the ad's load, which refuses an ad without the answer.

Exceptions

OperationCanceledException

cancellationToken was canceled.

ShowPrivacyOptions(IUiContext, CancellationToken)

Shows the network's form again, for the person to change their answer.

public Task ShowPrivacyOptions(IUiContext uiContext, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The app's UI context.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that completes once the form is closed.

Exceptions

AdException

The network's form failed.

OperationCanceledException

cancellationToken was canceled.