Configure SDK
1. Enable test mode
Test mode allows you to show our test ads with 100% fillrate.
Appodeal.setTesting(true);
2. Enable logging
To enable debug logging, use the code below:
Appodeal.setLogLevel(Log.LogLevel.debug);
Appodeal
tag.Available parameters:
Log.LogLevel.none
- logs off;Log.LogLevel.debug
- debug messages;Log.LogLevel.verbose
- all SDK and ad network messages.
3. Disable networks
Appodeal.disableNetwork(this, AppodealNetworks.NETWORK);
AppodealNetworks
.Important
Should be called before the SDK initialization.
4. Disable networks for specific ad types
Appodeal.disableNetwork(this, AppodealNetworks.NETWORK, adTypes);
Appodeal.disableNetwork(this, AppodealNetworks.ADMOB, Appodeal.BANNER | Appodeal.INTERSTITIAL);
5. Request Android M permissions
To request "WRITE_EXTERNAL_STORAGE
" and "ACCESS_COARSE_LOCATION
" permissions on Android M and higher, call the following method:
6. Disable location permission check
To disable toast message "ACCESS_COARSE_LOCATION permission is missing", use the following method before the SDK initialization:
Appodeal.disableLocationPermissionCheck();
7. Disable write external storage permission check
To disable toast-messages "WRITE_EXTERNAL_STORAGE permission is missing", use the following method before the SDK initialization:
Appodeal.disableWriteExternalStoragePermissionCheck();
8. Test third-party networks adapters integration
To start test activity for testing adapters integration, call:
Appodeal.startTestActivity((Activity) this);
9. Change Data Protection Regulation (GDPR, CCPA) consent status
1. Starting from version 2.7.0 you can use the Stack Consent Manager SDK to update the user's consent:
Read our implementation Stack Consent Manager guide here.
//use getConsent() after obtaining consent Consent consent = ConsentManager.getInstance(this).getConsent(); Appodeal.updateConsent(consent);
2. If you don't want to use the Stack Content Manager SDK, you can use the old version to update the user's consent:
Appodeal.updateConsent(true);
true
.You can read more info about GDPR/CCPA here.
10. Disable data collection for kids apps
For purposes of the Children's Online Privacy Protection Act (COPPA), there is a setting in Appodeal SDK. As an app developer, you can indicate whether you want networks in Appodeal SDK to treat your content as child-directed when you make an ad request.The setting can be used with Appodeal SDK via:
Appodeal.setChildDirectedTreatment(@Nullable Boolean value);
Call setChildDirectedTreatment
with true
to indicate that you want your content treated as child-directed for purposes of COPPA
Call setChildDirectedTreatment
with false
to indicate that you don't want your content treated as child-directed for purposes of COPPA
Call setChildDirectedTreatment
with null
to indicate that you want to use the COPPA parameter from your application's settings on the appodeal.com
11. Check if ad type was initialized
Appodeal.isInitialized((Activity)this, adType);
true
, if the ad type was initialized.12. Check if autocache is enabled for ad type
Appodeal.isAutoCacheEnabled((Activity)this, adType);
true
, if auto cache is enabled for this ad type.13. Mute videos if call volume is muted
Appodeal.muteVideosIfCallsMuted(true);
14. Send extra data
You can send key-value data to Appodel. There is the predefined key ExtraData.APPSFLYER_ID
.
public static void setExtraData(@NonNull String key, @NonNull String value) public static void setExtraData(@NonNull String key, int value) public static void setExtraData(@NonNull String key, double value) public static void setExtraData(@NonNull String key, boolean value) public static void setExtraData(@NonNull String key, @NonNull JSONObject value)
15. Get predicted eCPM by ad type
For all ad types excluding native ads:
public static double getPredictedEcpm(final int adTypes);
double getPredictedEcpm();
16. Enable Shared View Ads Instance Across Activities Logic
Starting from SDK 2.8.1 Appodeal SDK binds the View ads (Banner/MREC) to the Activity which was passed to the Appodeal.show
method.
To make it easier for you to manage View ads display logic across all Activities we added a new method in Appodeal class:
public static void setSharedAdsInstanceAcrossActivities(boolean sharedAdsInstanceAcrossActivities); // Default - false
- When this method is used with the
true
parameter, the SDK will show AdView on all new activities without calling additional code from your side. - If you want to control the display yourself, you can call the method with the
false
parameter.
In the case, this parameter is false
, be careful with changing orientation or moving to a new activity, the banner will not be shown automatically, since it was bound to the previous activity.
If you want to hide the banner, you need to call the Appodeal.hide()
method with the parameters of the activity to which the banner was bound.
You can also check the current state of this logic. By default value is false
:
public static boolean isSharedAdsInstanceAcrossActivities();
17. Debug / Test mode via ADB
Starting from SDK 2.8.0 we've added new logic to enable test mode via ADB commands, which can be used with Debug and Release builds of apps
Command | Values | Description |
---|---|---|
adb shell setprop debug.appodeal.sdk.testmode | true / false / .none. | Command for set Test Mode |
adb shell setprop debug.appodeal.sdk.log | true / false / .none. | Command for enabling/disabling logs |
adb shell setprop debug.appodeal.sdk.loglevel | none / debug / verbose / .none. | Command for set logging level |
adb shell setprop debug.appodeal.sdk.testactivity | true / false / .none. | Command for enabling Test Activity starting on SDK initialization |
adb shell setprop debug.appodeal.sdk.networks | An array of strings, with comma divider (e.g - admob,unity_ads,...) | Command for set enabled ad networks |
.none.
- is the default state for all commands and related parameters