Best practices
These recommendations help you get the most out of the SDK and avoid the integration mistakes that cause lost revenue, wasted requests or policy problems.
Initialization
Section titled “Initialization”- Initialize the SDK in
Application.onCreate. An ad requested beforeWortiseSdk.initializehas been called fails withSDK_NOT_INITIALIZED. Initializing in theApplicationclass guarantees that everyActivity, and every banner declared in a layout, finds the SDK ready. - Load and show ads only from the main process of the app.
WortiseSdk.initializedoes nothing when it is called from a secondary process, so the ads requested there cannot be filled. - Do not declare Google Mobile Ads or the bundled mediation adapters in your own dependencies. The SDK already includes
play-services-adsand its adapters in the versions it has been tested with, and forcing different versions can break the build or the ads at runtime.
Consent and privacy
Section titled “Consent and privacy”-
Request the user consent on every app launch, before loading the first ad. The SDK never shows the consent dialog on its own, and
ConsentManager.requestIfRequiredonly shows it when it is needed. Ads requested without consent, where it is required, cannot be personalized and generate less revenue. -
Load the ads when the consent request finishes. The listener is always invoked, whether the dialog has been shown or not:
WortiseSdk.wait {ConsentManager.requestIfRequired(this) {// The consent request has finished: the ads can be loaded nowloadAds()}} -
If you already use another consent platform, make sure it is IAB TCF compliant. The SDK reads the consent string that these platforms store, so there is no need to request the consent twice.
-
If your app is directed to children, follow the Families program guide. Those apps must integrate
android-sdk-familiesinstead ofandroid-sdk, and mark their users before initializing the SDK.
Loading ads
Section titled “Loading ads”-
Create each interstitial, rewarded or app open ad once, and load it in advance. Loading takes time, so an ad requested at the moment it has to be shown will not be ready.
-
Do not call
loadAd()on an ad that is already loaded. A new load discards the ad that was ready to be shown, which wastes a filled request. -
Load the next ad when the current one is dismissed. A fullscreen ad can be shown only once, so call
loadAd()again in theon…Dismissedcallback (or enableautoReloadin app open ads). -
Do not retry immediately after a failed load. After a failed load of a fullscreen or native ad, the SDK applies a cooldown (30 seconds by default) during which
loadAd()is ignored and no callback is invoked. Wait before retrying, usingcooldownRemainingMsas the minimum delay:override fun onInterstitialFailedToLoad(ad: InterstitialAd, error: AdError) {val delay = maxOf(ad.cooldownRemainingMs, 30_000L)handler.postDelayed({ ad.loadAd() }, delay)} -
Do not wait indefinitely for a load callback.
loadAd()does not invoke any callback when the ad is already loading or in cooldown, so do not block the app flow on it.
Showing ads
Section titled “Showing ads”- Check
isAvailablebefore callingshowAd(). When no ad is available,showAd()returns without showing anything and without invoking any callback, so the app must be able to continue on its own. - Continue the app flow from both
on…Dismissedandon…FailedToShow. An ad that could not be shown never reacheson…Dismissed, so handling only that callback can leave the app waiting. - Grant the reward only in
onRewardedCompleted.onRewardedDismissedis also invoked when the user closes the ad without completing it. - Show fullscreen ads at natural pauses of the app. Ads that interrupt the user in the middle of an action, or that appear unexpectedly, cause accidental clicks, which go against the policies of the ad networks.
Banners
Section titled “Banners”- Use one
BannerAdper placement and keep it while its screen is alive. Creating a new banner on every refresh of the UI multiplies the ad requests without generating more impressions. - Do not call
loadAd()to refresh a banner or to retry a failed load. The banner refreshes itself while it is visible, and after a failed load it retries automatically one minute later. - A banner declared in a layout with
app:adUnitIdloads automatically. CallingloadAd()on it cancels the request in progress and sends a second one. - Set the ad unit ID only once. Assigning a different ad unit ID to a banner that already has one throws an
IllegalArgumentException, so do not reuse the same instance for different ad units. - In Jetpack Compose, create the banner with
rememberand callloadAd()in thefactoryblock ofAndroidView, never inupdate, which runs on every recomposition.
App open
Section titled “App open”- Choose one integration:
AppOpenManageror your ownAppOpenAd. The manager already shows an ad every time the app returns to the foreground, so showing another one manually at the same moment would display two ads in a row. - Do not expect an ad on the first app launch with
AppOpenManager. The first ad is being loaded at that moment, and it is shown the next time the app returns to the foreground. - Take into account that any return to the foreground counts, including coming back from an ad click or from another app. If you need to limit how often these ads appear, use
AppOpenAdand decide when to callshowAd().
Releasing resources
Section titled “Releasing resources”- Call
destroy()on every banner when its screen is destroyed. A banner holds system listeners, timers and the ad view of the network that filled it, and it only releases them indestroy(). - Call
destroy()on fullscreen ads, native ads and native ad loaders when they are no longer needed. - Do not keep ads created with an
Activityin static fields or singletons. The ad holds a reference to the context it was created with.
Testing
Section titled “Testing”-
Use test mode or the test ad units during development, and never click on real ads. Impressions and clicks made by the developers on real ads are invalid traffic and can get the account penalized.
-
Enable test mode only in debug builds. Test mode is not persisted, so it must be set on every launch before loading ads, and an app published with it enabled does not generate revenue:
AdSettings.testEnabled = BuildConfig.DEBUG
Before you publish
Section titled “Before you publish”- The SDK is initialized in
Application.onCreatewith the app key of the app. - The
com.google.android.gms.ads.APPLICATION_IDmeta-data contains the Google App ID shown in the Wortise dashboard for the app. - Every ad uses its production ad unit ID: no
test-…ad unit is left in the code. - Test mode is disabled in release builds.
- The user consent is requested before the first ad is loaded.
- Fullscreen ads are shown only after checking
isAvailable, and the app continues when an ad is not available. - Banners, fullscreen ads and native ads are destroyed with their screens.
- Apps directed to children use
android-sdk-familiesand follow the Families program checklist. - A release build (with R8 enabled, if you use it) has been tested on a real device. No additional ProGuard rules are required.
© 2026 Wortise. All rights reserved.