-
Notifications
You must be signed in to change notification settings - Fork 7
App open ads
App open ads are displayed using the IAppOpenAdService
service. The service is registered by the plugin and can be either injected or retrieved from the service provider as follows:
var appOpenAdService = IPlatformApplication.Current.Services.GetService<IAppOpenAdService>();
Once you grab hold of the service instance, the next step is to preload the app open ad. You can do so by calling the PrepareAd
method. You can pass your adUnitId
as a parameter, or call it without any parameters to use the configured AdConfig.DefaultAppOpenAdUnitId
. After the ad is prepared, simply call ShowAd()
to display the app open ad.
public interface IAppOpenAdService
{
IOpenAppAd CreateAd(string adUnitId = null);
void PrepareAd(string adUnitId = null);
void ShowAd();
}
void PrepareAd(string adUnitId = null)
Preloads an app open ad using the provided adUnitId
. If no adUnitId
is provided, it will use configured default - AdConfig.DefaultAppOpenAdUnitId
.
void ShowAd()
Displays the app openad which was prepared when PrepareAd
was called. If no ad was prepared, nothing will be shown.
IAppOpenAd CreateAd(string adUnitId = null)
Creates an app open ad instance which you can use to preload and show later on. This enables you to preload multiple app open ads at the same time, using different ad unit IDs. If no adUnitId
is provided, it will use configured default - AdConfig.DefaultAppOpenAdUnitId
.