Class AdsKit
AdsKit allows you to show reward ads in the game.
Inheritance
Namespace: Pley
Assembly: Pley.dll
Syntax
public static class AdsKit : object
Remarks
You need to enable the ads for your game from within the Game Manager settings page.
Methods
CanShowAdAsync(PleyAdType)
Check if an ad can be shown at this time.
Declaration
public static async Task<(PleyResult, bool)> CanShowAdAsync(PleyAdType adType)
Parameters
Type | Name | Description |
---|---|---|
PleyAdType | adType |
Returns
Type | Description |
---|---|
Task<System.ValueTuple<PleyResult, System.Boolean>> | Returns if reward ads can be shown or not, possible error are the following: AdkUnknown, AdkAdsDisabled, AdkNotReady, AdkTimeout, AdkInvalid, AdkError, AdkNoAdPreloaded, AdkFrequencyCapped, AdkAlreadyShowingAd |
Remarks
This method should to be called once before each call to ShowAdAsync(PleyAdType)
CanShowRewardAdAsync()
Check if reward ads can be shown at this time.
Declaration
public static async Task<(PleyResult, bool)> CanShowRewardAdAsync()
Returns
Type | Description |
---|---|
Task<System.ValueTuple<PleyResult, System.Boolean>> | Returns if reward ads can be shown or not, possible error are the following: AdkUnknown, AdkAdsDisabled, AdkNotReady, AdkTimeout, AdkInvalid, AdkError, AdkNoAdPreloaded, AdkFrequencyCapped, AdkAlreadyShowingAd |
Remarks
This method should to be called once before each call to ShowAdAsync(PleyAdType)
ShowAdAsync(PleyAdType)
Show an ad
Declaration
public static async Task<PleyResult> ShowAdAsync(PleyAdType adType)
Parameters
Type | Name | Description |
---|---|---|
PleyAdType | adType | The type of ad to show. |
Returns
Type | Description |
---|---|
Task<PleyResult> | Returns if reward ads can be shown or not, possible error are the following: AdkUnknown, AdkAdsDisabled, AdkNotReady, AdkTimeout, AdkInvalid, AdkError, AdkNoAdPreloaded, AdkFrequencyCapped, AdkDismissed, AdkAlreadyShowingAd |
ShowRewardAdAsync()
Show a reward ad (timed ad)
Declaration
public static async Task<PleyResult> ShowRewardAdAsync()
Returns
Type | Description |
---|---|
Task<PleyResult> | Returns if reward ads can be shown or not, possible error are the following: AdkUnknown, AdkAdsDisabled, AdkNotReady, AdkTimeout, AdkInvalid, AdkError, AdkNoAdPreloaded, AdkFrequencyCapped, AdkDismissed, AdkAlreadyShowingAd |
Remarks
CanShowRewardAdAsync() NEEDS to be called before each reward ad. If the ad was canceled/dismissed before watching the entire ad the resuklt will be AdkDismissed otherwise Ok