Skip to main content
Version: 6.x.x

Error Handling

In case where an ad fails to load or display, BlueStack provides the following exceptions in error callback.

ExceptionError CodeMessageMeaning
WrongPlacementIdErrorWRONG_PLACEMENT_ERROR = 0Wrong placementInvalid placement ID configured
InternetErrorNO_INTERNET_ERROR = 1No InternetNo internet connection available
SDKUninitializedErrorSDK_UNINITIALIZED_ERROR = 2BlueStack is not initializedSDK must be initialized first
RequestCappedErrorCAPPED_REQUEST_ERROR = 3Your request has been cappedRequest limit reached. Check placement capping settings
LockedPlacementErrorLOCKED_PLACEMENT_ERROR = 4This placement is locked by an other factoryAnother factory is loading an ad for this placement
BusyFactoryErrorBUSY_FACTORY_ERROR = 5Your factory is busyFactory is processing another request
NoAdErrorNO_AD_ERROR = 7No Ad foundNo ad available to deliver
InterstitialCoolDownErrorINTERSTITIAL_COOLDOWN_ERROR = 8Interstitial cooldown activeInterstitial ad is in cooldown period. Wait before showing another
AlreadyShownInterstitialErrorINTERSTITIAL_ALREADY_SHOWN_ERROR = 9Other Interstitial is shownOnly one interstitial can be shown at a time
TimeOutErrorTIME_OUT_ERROR = 10no ad to deliver before time outAd request timed out before response
AdapterNotFoundErrorADAPTER_NOT_FOUND_ERROR = 11No adapter foundMediation adapter not found. See Mediation Partners
BlockedByGDPRErrorBLOCKED_BY_GDPR = 12Request blocked by GDPRAd request blocked due to GDPR consent requirements
AdExpiredErrorAD_EXPIRED = 13Ad has expiredAd exceeded display time limit (typically for interstitials)
NoAdapterFoundForPlacementIdErrorNO_ADAPTER_FOUND_FOR_PLACEMENT_ID = 14No adapter found for placementIdNo mediation adapter configured for the specific placement ID

Handle Error : To determine which exception was triggered, cast the exception to AdError in the fail callback and use getErrorCode() to retrieve the error code. You can also get the exception message by calling getMessage(). In the example below, we use onAdFailToLoad, but this logic can be applied to any fail callback, such as onAdFailToRefresh, onAdFailedToDisplay, infeedDidFail and nativeObjectDidFail etc.

@Override
public void onAdFailedToLoad(Exception e) {
AdError adError = (AdError)e;

switch (adError.getErrorCode())
{
case AdError.BUSY_FACTORY_ERROR :
case AdError.INTERSTITIAL_ALREADY_SHOWN_ERROR :
.
.
.
}
Log.e(TAG, "Banner did fail : " + adError.getMessage()+" error code "+adError.getErrorCode());
}