Class AdClientImpl
Inheritance
Namespace: EasyMobile
Assembly: cs.temp.dll.dll
Syntax
public abstract class AdClientImpl : IAdClient, IConsentRequirable
Fields
mIsInitialized
Declaration
protected bool mIsInitialized
Field Value
Type | Description |
---|---|
System.Boolean |
Properties
CustomInterstitialAdsDict
Defined interstitial AdPlacement(s) in EM_Settings.
Declaration
protected abstract Dictionary<AdPlacement, AdId> CustomInterstitialAdsDict { get; }
Property Value
Type | Description |
---|---|
Dictionary<AdPlacement, AdId> |
CustomRewardedAdsDict
Defined rewarded AdPlacement(s) in EM_Settings.
Declaration
protected abstract Dictionary<AdPlacement, AdId> CustomRewardedAdsDict { get; }
Property Value
Type | Description |
---|---|
Dictionary<AdPlacement, AdId> |
DataPrivacyConsent
The data privacy consent status of the associated ad network, default to ConsentStatus.Unknown.
Declaration
public virtual ConsentStatus DataPrivacyConsent { get; }
Property Value
Type | Description |
---|---|
ConsentStatus |
DataPrivacyConsentSaveKey
Declaration
protected abstract string DataPrivacyConsentSaveKey { get; }
Property Value
Type | Description |
---|---|
System.String |
DefinedCustomInterstitialAdPlacements
All the custom interstitial AdPlacement(s) defined in EM_Settings.
If there's no such custom placement defined, this will return null
.
Declaration
public List<AdPlacement> DefinedCustomInterstitialAdPlacements { get; }
Property Value
Type | Description |
---|---|
List<AdPlacement> |
DefinedCustomRewardedAdPlacements
All the custom rewarded AdPlacement(s) defined in EM_Settings.
If there's no such custom placement defined, this will return null
.
Declaration
public List<AdPlacement> DefinedCustomRewardedAdPlacements { get; }
Property Value
Type | Description |
---|---|
List<AdPlacement> |
IsBannerAdSupported
Whether banner ads are supported.
Declaration
public abstract bool IsBannerAdSupported { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsInitialized
Gets a value indicating whether this client is initialized.
Declaration
public virtual bool IsInitialized { get; }
Property Value
Type | Description |
---|---|
System.Boolean | true |
IsInterstitialAdSupported
Whether interstitial ads are supported.
Declaration
public abstract bool IsInterstitialAdSupported { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsRewardedAdSupported
Whether rewarded ads are supported.
Declaration
public abstract bool IsRewardedAdSupported { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsSdkAvail
Whether the required SDK is available.
Declaration
public abstract bool IsSdkAvail { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Network
Gets the associated ad network of this client.
Declaration
public abstract AdNetwork Network { get; }
Property Value
Type | Description |
---|---|
AdNetwork | The network. |
NoSdkMessage
The message to print if the required SDK is not available.
Declaration
protected abstract string NoSdkMessage { get; }
Property Value
Type | Description |
---|---|
System.String | The no sdk message. |
Methods
ApplyDataPrivacyConsent(ConsentStatus)
Implement this method and perform whatever actions needed for the client to response to the specified data privacy consent. This is intended to be used with the consent obtained from GetApplicableDataPrivacyConsent().
Declaration
protected abstract void ApplyDataPrivacyConsent(ConsentStatus consent)
Parameters
Type | Name | Description |
---|---|---|
ConsentStatus | consent | Consent. |
CheckInitialize(Boolean)
Checks if the client is initialized and print a warning message if not.
Declaration
protected virtual bool CheckInitialize(bool logMessage = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | logMessage |
Returns
Type | Description |
---|---|
System.Boolean |
|
DestroyBannerAd()
Destroys the banner ad at the default placement.
Declaration
public virtual void DestroyBannerAd()
DestroyBannerAd(AdPlacement)
Destroys the banner ad at the specified placement.
Declaration
public virtual void DestroyBannerAd(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
FindIdForPlacement(Dictionary<AdPlacement, AdId>, AdPlacement)
Returns the cross-platform ID associated with placement in the given dictionary.
Returns string.Empty
if no such ID found.
Declaration
protected virtual string FindIdForPlacement(Dictionary<AdPlacement, AdId> dict, AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<AdPlacement, AdId> | dict | Dict. |
AdPlacement | placement | Placement. |
Returns
Type | Description |
---|---|
System.String | The identifier for placement. |
GetApplicableDataPrivacyConsent()
Finds the applicable data privacy consent for this client by searching upward from provider-level consent to global-level consent (high priority -> low priority).
Declaration
protected virtual ConsentStatus GetApplicableDataPrivacyConsent()
Returns
Type | Description |
---|---|
ConsentStatus | The applicable data privacy consent. |
GetCustomPlacementsFromDefinedDict(Dictionary<AdPlacement, AdId>)
Return a list of AdPlacement(s) from the dictionary defined in EM_Settings.
Declaration
protected List<AdPlacement> GetCustomPlacementsFromDefinedDict(Dictionary<AdPlacement, AdId> dict)
Parameters
Type | Name | Description |
---|---|---|
Dictionary<AdPlacement, AdId> | dict |
Returns
Type | Description |
---|---|
List<AdPlacement> |
GrantDataPrivacyConsent()
Grants provider-level data privacy consent for the associated ad network. This consent persists across app launches.
Declaration
public virtual void GrantDataPrivacyConsent()
HideBannerAd()
Hides the banner ad at the default placement.
Declaration
public virtual void HideBannerAd()
HideBannerAd(AdPlacement)
Hides the banner ad at the specified placement.
Declaration
public virtual void HideBannerAd(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
Init()
Initializes the client.
Declaration
public virtual void Init()
InternalDestroyBannerAd(AdPlacement)
Instructs the underlaying SDK to destroy a banner ad. Only invoked if the client is initialized.
Declaration
protected abstract void InternalDestroyBannerAd(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
InternalHideBannerAd(AdPlacement)
Instructs the underlaying SDK to hide a banner ad. Only invoked if the client is initialized.
Declaration
protected abstract void InternalHideBannerAd(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
InternalInit()
Does the SDK-specific initialization. Only invoked if the client is not initialized.
Declaration
protected abstract void InternalInit()
InternalIsInterstitialAdReady(AdPlacement)
Checks with the underlaying SDK to see if an interstitial ad is loaded. Only invoked if the client is initialized.
Declaration
protected abstract bool InternalIsInterstitialAdReady(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
Returns
Type | Description |
---|---|
System.Boolean |
|
InternalIsRewardedAdReady(AdPlacement)
Checks with the underlaying SDK to see if a rewarded ad is loaded. Only invoked if the client is initialized.
Declaration
protected abstract bool InternalIsRewardedAdReady(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
Returns
Type | Description |
---|---|
System.Boolean |
|
InternalLoadInterstitialAd(AdPlacement)
Instructs the underlaying SDK to load an interstitial ad. Only invoked if the client is initialized.
Declaration
protected abstract void InternalLoadInterstitialAd(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
InternalLoadRewardedAd(AdPlacement)
Instructs the underlaying SDK to load a rewarded ad. Only invoked if the client is initialized.
Declaration
protected abstract void InternalLoadRewardedAd(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
InternalShowBannerAd(AdPlacement, BannerAdPosition, BannerAdSize)
Instructs the underlaying SDK to show a banner ad. Only invoked if the client is initialized.
Declaration
protected abstract void InternalShowBannerAd(AdPlacement placement, BannerAdPosition position, BannerAdSize size)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
BannerAdPosition | position | Position. |
BannerAdSize | size | Size. |
InternalShowInterstitialAd(AdPlacement)
Instructs the underlaying SDK to show an interstitial ad. Only invoked if the client is initialized.
Declaration
protected abstract void InternalShowInterstitialAd(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
InternalShowRewardedAd(AdPlacement)
Instructs the underlaying SDK to show a rewarded ad. Only invoked if the client is initialized.
Declaration
protected abstract void InternalShowRewardedAd(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
IsInterstitialAdReady()
Determines whether the interstitial ad at the default placement is loaded.
Declaration
public virtual bool IsInterstitialAdReady()
Returns
Type | Description |
---|---|
System.Boolean |
|
IsInterstitialAdReady(AdPlacement)
Determines whether the interstitial ad at the specified placement is loaded.
Declaration
public virtual bool IsInterstitialAdReady(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsRewardedAdReady()
Determines whether the rewarded ad ready at the default placement is loaded.
Declaration
public virtual bool IsRewardedAdReady()
Returns
Type | Description |
---|---|
System.Boolean |
|
IsRewardedAdReady(AdPlacement)
Determines whether the rewarded ad at the specified placement is loaded.
Declaration
public virtual bool IsRewardedAdReady(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
Returns
Type | Description |
---|---|
System.Boolean |
|
IsValidPlacement(AdPlacement, AdType)
Checks if the placement is valid, i.e. it has non-empty associated IDs if such placement require dedicated IDs.
Declaration
public abstract bool IsValidPlacement(AdPlacement placement, AdType type)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
AdType | type |
Returns
Type | Description |
---|---|
System.Boolean |
LoadInterstitialAd()
Loads the interstitial ad at the default placement.
Declaration
public virtual void LoadInterstitialAd()
LoadInterstitialAd(AdPlacement)
Loads the interstitial ad at the specified placement.
Declaration
public virtual void LoadInterstitialAd(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
LoadRewardedAd()
Loads the rewarded ad at the default placement.
Declaration
public virtual void LoadRewardedAd()
LoadRewardedAd(AdPlacement)
Loads the rewarded ad at the specified placement.
Declaration
public virtual void LoadRewardedAd(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
OnInterstitialAdCompleted(AdPlacement)
Raises the InterstitialAdCompleted event on main thread.
Declaration
protected virtual void OnInterstitialAdCompleted(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
OnRewardedAdCompleted(AdPlacement)
Raises the RewardedAdCompleted event on main thread.
Declaration
protected virtual void OnRewardedAdCompleted(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
OnRewardedAdSkipped(AdPlacement)
Raises the RewardedAdSkipped event on main thread.
Declaration
protected virtual void OnRewardedAdSkipped(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
ReadDataPrivacyConsent()
Reads the data privacy consent from persistent storage.
Declaration
protected virtual ConsentStatus ReadDataPrivacyConsent()
Returns
Type | Description |
---|---|
ConsentStatus | The data privacy consent. |
RevokeDataPrivacyConsent()
Revokes the provider-level data privacy consent of the associated ad network. This consent persists across app launches.
Declaration
public virtual void RevokeDataPrivacyConsent()
SaveDataPrivacyConsent(ConsentStatus)
Saves the data privacy consent to persistent storage.
Declaration
protected virtual void SaveDataPrivacyConsent(ConsentStatus consent)
Parameters
Type | Name | Description |
---|---|---|
ConsentStatus | consent | Consent. |
ShowBannerAd(AdPlacement, BannerAdPosition, BannerAdSize)
Shows the banner ad at the specified placement, position and size.
Declaration
public virtual void ShowBannerAd(AdPlacement placement, BannerAdPosition position, BannerAdSize size)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
BannerAdPosition | position | Position. |
BannerAdSize | size | Size. |
ShowBannerAd(BannerAdPosition, BannerAdSize)
Shows the banner ad at the default placement.
Declaration
public virtual void ShowBannerAd(BannerAdPosition position, BannerAdSize size)
Parameters
Type | Name | Description |
---|---|---|
BannerAdPosition | position | Position. |
BannerAdSize | size | Size. |
ShowInterstitialAd()
Shows the interstitial ad at the specified placement.
Declaration
public virtual void ShowInterstitialAd()
ShowInterstitialAd(AdPlacement)
Shows the interstitial ad at the specified placement.
Declaration
public virtual void ShowInterstitialAd(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
ShowRewardedAd()
Shows the rewarded ad at the default placement.
Declaration
public virtual void ShowRewardedAd()
ShowRewardedAd(AdPlacement)
Shows the rewarded ad at the specified placement.
Declaration
public virtual void ShowRewardedAd(AdPlacement placement)
Parameters
Type | Name | Description |
---|---|---|
AdPlacement | placement | Placement. |
Events
DataPrivacyConsentUpdated
Raised when the data privacy consent of the associated ad network is changed.
Declaration
public event Action<ConsentStatus> DataPrivacyConsentUpdated
Event Type
Type | Description |
---|---|
System.Action<ConsentStatus> |
InterstitialAdCompleted
Occurs when an interstitial ad completed.
Declaration
public event Action<IAdClient, AdPlacement> InterstitialAdCompleted
Event Type
Type | Description |
---|---|
System.Action<IAdClient, AdPlacement> |
RewardedAdCompleted
Occurs when a rewarded ad completed.
Declaration
public event Action<IAdClient, AdPlacement> RewardedAdCompleted
Event Type
Type | Description |
---|---|
System.Action<IAdClient, AdPlacement> |
RewardedAdSkipped
Occurs when a rewarded ad is skipped.
Declaration
public event Action<IAdClient, AdPlacement> RewardedAdSkipped
Event Type
Type | Description |
---|---|
System.Action<IAdClient, AdPlacement> |