Interstitial Ad Options
Interstitial ads have various advanced features that allow you to perform additional customizations and provide the best ad experience. This guide explains how to use the advanced features of interstitial ads.
GfpTheme Configuration
Some ads provided through the NDA module are rendered differently based on the configured GfpTheme value, distinguishing between light theme and dark theme.
While you can set a global GfpTheme configuration through NdaProviderOptions.Builder().setTheme(GfpTheme), if you want to apply a GfpTheme to a single ad only, call GfpInterstitialAdOptions.Builder().setTheme().
- If not set, it will be rendered according to the DayNight value set on the device.
- If this option is set, it will be rendered according to the requested GfpTheme value.
The example below shows how to set it to dark theme.
- Kotlin
- Java
val interstitialAdOptions = GfpInterstitialAdOptions.Builder()
.setTheme(ResolvedTheme.DARK)
.build()
...
interstitialAdManager.setInterstitialAdOptions(interstitialAdOptions)
GfpInterstitialAdOptions interstitialAdOptions = new GfpInterstitialAdOptions.Builder()
.setTheme(ResolvedTheme.DARK)
.build();
...
interstitialAdManager.setInterstitialAdOptions(interstitialAdOptions);
Timeout Configuration
The request timeout value for interstitial ads can be set globally through SdkPropertiesBuilder.interstitialAdRequestTimeout(), but if you want to set a timeout for a single ad request, you can set it through the setTimeoutMillis() method of GfpInterstitialAdManager as shown in the example below.
The example below shows how to set a timeout value of 10 seconds for a single ad request loaded by a specific GfpInterstitialAdManager. When you set a timeout value for a single ad request as shown below, the globally set timeout value will be ignored.
If no timeout value is set in SdkProperties and GfpInterstitialAdManager, the default value of 60 seconds will be set as the timeout value.
- Kotlin
- Java
val interstitialAdManager: GfpInterstitialAdManager = ...
interstitialAdManager.setTimeoutMillis(10_000L)
GfpInterstitialAdManager interstitialAdManager = ...;
interstitialAdManager.setTimeoutMillis(10_000L);