SDK Integration | Appodeal Intelligent Ad Mediation

SDK Integration

Link your Admob account

Appodeal yields optimal results in cooperation with Admob. To continue, you need to link your Admob account.

If you don't have Admob account, please sign up on Admob.com.

To link your Admob account to Appodeal, use the Chrome extension:

INSTALL EXTENSION


The extension source code is available at https://github.com/appodeal/admob-configurator.

The extension will make two changes in your Admob account. First, it will allow Appodeal to access your Admob reports over API, and second, it will create new ad units on Admob and submit them to Appodeal.

VIDEO TUTORIAL

Download Sdk

You can download Android SDK here.

Make sure you are using third party libraries from downloaded archive.

Import Cheetah Mobile SDK. In Android Studio go File -> New Module -> Import .JAR/.AAR and select optional/cheetah-mobile-3.4.7.aar file from SDK archive. Add dependency to your gradle file:

compile project(':cheetah-mobile-3.4.7')

To disable "Cheetah Mobile not found" toasts use:

Appodeal.disableNetwork(this, "cheetah");

Minimum OS requirements: Android API level 9 (Android OS 2.3).

AndroidManifest.xml

Add following to your AndroidManifest.xml:

Add following under manifest tag:

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- Optional -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />

Add following under application tag:

<meta-data android:name="com.appodeal.framework" android:value="android" />
<receiver android:name="com.appodeal.ads.AppodealPackageAddedReceiver" android:exported="true" android:enabled="true">
<intent-filter>
    <action android:name="android.intent.action.PACKAGE_ADDED" />
    <data android:scheme="package" />
</intent-filter>
</receiver>

<activity android:name="com.appodeal.ads.InterstitialActivity"
      android:configChanges="orientation|screenSize"
      android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<activity android:name="com.appodeal.ads.VideoActivity"
      android:configChanges="orientation|screenSize"
      android:theme="@android:style/Theme.Translucent.NoTitleBar" />

<activity android:name="com.appodeal.ads.LoaderActivity"
      android:configChanges="orientation|screenSize"
      android:theme="@android:style/Theme.Translucent.NoTitleBar" />

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

<activity android:name="com.google.android.gms.ads.AdActivity"
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
      android:theme="@android:style/Theme.Translucent" />

<activity android:name="com.chartboost.sdk.CBImpressionActivity" android:excludeFromRecents="true"
      android:hardwareAccelerated="true" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
      android:configChanges="keyboardHidden|orientation|screenSize" />

<activity android:name="com.applovin.adview.AppLovinInterstitialActivity"
      android:theme="@android:style/Theme.Translucent" />

<activity android:name="com.mopub.mobileads.MoPubActivity"
      android:configChanges="keyboardHidden|orientation|screenSize"
      android:theme="@android:style/Theme.Translucent" />
<activity android:name="com.mopub.common.MoPubBrowser"
      android:configChanges="keyboardHidden|orientation|screenSize" />
<activity android:name="com.mopub.mobileads.MraidActivity"
      android:configChanges="keyboardHidden|orientation|screenSize" />
<activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity"
      android:configChanges="keyboardHidden|orientation|screenSize" />

<activity android:name="org.nexage.sourcekit.mraid.MRAIDBrowser"
      android:configChanges="orientation|keyboard|keyboardHidden|screenSize"
      android:theme="@android:style/Theme.Translucent" />


<activity android:name="com.amazon.device.ads.AdActivity" android:configChanges="keyboardHidden|orientation|screenSize"/>

<activity android:name="com.my.target.ads.MyTargetActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:hardwareAccelerated="true"/>

<activity android:name="org.nexage.sourcekit.vast.activity.VASTActivity"
      android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />

<activity android:name="org.nexage.sourcekit.vast.activity.VPAIDActivity"
      android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />

<!--suppress AndroidDomInspection -->
<activity android:name="com.appodeal.ads.networks.vpaid.VPAIDActivity"
      android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />

<activity android:name="com.appodeal.ads.networks.SpotXActivity"
      android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
<!--suppress AndroidDomInspection -->
<activity android:name="com.facebook.ads.InterstitialAdActivity" android:configChanges="keyboardHidden|orientation|screenSize" />

<activity android:name="com.unity3d.ads.adunit.AdUnitActivity"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:hardwareAccelerated="true" />
<activity android:name="com.unity3d.ads.adunit.AdUnitSoftwareActivity"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:hardwareAccelerated="false" />
<activity android:name="com.unity3d.ads2.adunit.AdUnitActivity"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:hardwareAccelerated="true" />
<activity android:name="com.unity3d.ads2.adunit.AdUnitSoftwareActivity"
    android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:hardwareAccelerated="false" />


<!--suppress AndroidDomInspection -->
<activity android:name="com.jirbo.adcolony.AdColonyOverlay"
      android:configChanges="keyboardHidden|orientation|screenSize"
      android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<!--suppress AndroidDomInspection -->
<activity android:name="com.jirbo.adcolony.AdColonyFullscreen"
      android:configChanges="keyboardHidden|orientation|screenSize"
      android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
<!--suppress AndroidDomInspection -->
<activity android:name="com.jirbo.adcolony.AdColonyBrowser"
      android:configChanges="keyboardHidden|orientation|screenSize"
      android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
<!--suppress AndroidDomInspection -->
<activity android:name="com.vungle.publisher.FullScreenAdActivity"
      android:configChanges="keyboardHidden|orientation|screenSize"
      android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
<!--suppress AndroidDomInspection -->
<activity android:name="com.startapp.android.publish.list3d.List3DActivity"
      android:theme="@android:style/Theme" />
<!--suppress AndroidDomInspection -->
<activity android:name="com.startapp.android.publish.OverlayActivity"
      android:theme="@android:style/Theme.Translucent"
      android:configChanges="orientation|keyboardHidden|screenSize" />
<!--suppress AndroidDomInspection -->
<activity android:name="com.startapp.android.publish.FullScreenActivity"
      android:theme="@android:style/Theme"
      android:configChanges="orientation|keyboardHidden|screenSize" />
<service android:name="com.yandex.metrica.MetricaService" android:enabled="true"
     android:exported="true" android:process=":Metrica">
	<intent-filter>
		<category android:name="android.intent.category.DEFAULT" />
		<action android:name="com.yandex.metrica.IMetricaService" />
		<data android:scheme="metrica" />
	</intent-filter>
	<meta-data android:name="metrica:api:level" android:value="44" />
</service>
<receiver android:name="com.yandex.metrica.MetricaEventHandler"
      android:enabled="true" android:exported="true">
	<intent-filter>
		<action android:name="com.android.vending.INSTALL_REFERRER" />
	</intent-filter>
</receiver>
<!--suppress AndroidDomInspection -->
<activity android:name="com.yandex.mobile.ads.AdActivity"
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

<!--suppress AndroidDomInspection -->
<activity android:name="com.flurry.android.FlurryFullscreenTakeoverActivity"
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />

<activity android:name="com.appodeal.ads.VideoPlayerActivity" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"/>

<!--suppress AndroidDomInspection -->
<activity android:name="com.revmob.FullscreenActivity" android:theme="@android:style/Theme.Translucent"
    android:configChanges="keyboardHidden|orientation"/>

<!--suppress AndroidDomInspection -->
<activity android:name="com.tapjoy.TJAdUnitActivity" android:configChanges="orientation|keyboardHidden|screenSize"
            android:hardwareAccelerated="true" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<!--suppress AndroidDomInspection -->
<activity android:name="com.tapjoy.mraid.view.ActionHandler" android:configChanges="orientation|keyboardHidden|screenSize" />
<!--suppress AndroidDomInspection -->
<activity android:name="com.tapjoy.mraid.view.Browser" android:configChanges="orientation|keyboardHidden|screenSize" />
<!--suppress AndroidDomInspection -->
<activity android:name="com.tapjoy.TJContentActivity" android:configChanges="orientation|keyboardHidden|screenSize"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" android:hardwareAccelerated="true" />

Callbacks and advanced features

Google Play device compatibility

If you are not using location services in you app and not using any other SDK that require ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permissions you can add the following code to manifest to make your app available on devices that don't have GPS support:

<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />

Android Integration

SDK and plugin integration

Place all .jar files from the SDK archive into the libs folder of your app.

Also include Google Play Services lib (7.5+) in your project.

compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'

Ad types

Appodeal.INTERSTITIAL

Appodeal.SKIPPABLE_VIDEO

Appodeal.BANNER

Appodeal.REWARDED_VIDEO

Appodeal.NON_SKIPPABLE_VIDEO - alias of Appodeal.REWARDED_VIDEO. Both of them shouldn't be used together

Appodeal.MREC

Appodeal.NATIVE

Ad types can be combined using "|" operator. For example Appodeal.INTERSTITIAL | Appodeal.SKIPPABLE_VIDEO

Note that it is better to use NON_SKIPPABLE_VIDEO or REWARDED_VIDEO, but if you are sure you want to use SKIPPABLE_VIDEO you must confirm usage by calling Appodeal.confirm(Appodeal.SKIPPABLE_VIDEO) before SDK initialization

SDK initialization

To initialize SDK you need to add following code in onCreate method of your main activity:

String appKey = "fee50c333ff3825fd6ad6d38cff78154de3025546d47a84f";
Appodeal.initialize(this, appKey, Appodeal.BANNER | Appodeal.INTERSTITIAL);

Note: appKey is the key you received when you created an app.

To initialize only interstitials use Appodeal.initialize(this, appKey, Appodeal.INTERSTITIAL);

To initialize only skippable videos use Appodeal.initialize(this, appKey, Appodeal.SKIPPABLE_VIDEO);

To initialize interstitials and videos use Appodeal.initialize(this, appKey, Appodeal.INTERSTITIAL | Appodeal.SKIPPABLE_VIDEO);

To initialize only banners use Appodeal.initialize(this, appKey, Appodeal.BANNER);

To initialize only rewarded video use Appodeal.initialize(this, appKey, Appodeal.REWARDED_VIDEO);

To initialize only non-skippable video use Appodeal.initialize(this, appKey, Appodeal.NON_SKIPPABLE_VIDEO);

To initialize only 300*250 banners use Appodeal.initialize(this, appKey, Appodeal.MREC);

To initialize only native ads use Appodeal.initialize(this, appKey, Appodeal.NATIVE);

Display ad

To display ad you need to call the following code in activity:

Appodeal.show(this, adTypes);

show() returns a boolean value indicating whether show call was passed to appropriate SDK

To display interstitial use Appodeal.show(this, Appodeal.INTERSTITIAL)

To display skippable video use Appodeal.show(this, Appodeal.SKIPPABLE_VIDEO)

To display rewarded video use Appodeal.show(this, Appodeal.REWARDED_VIDEO)

To display non-skippable video use Appodeal.show(this, Appodeal.NON_SKIPPABLE_VIDEO)

To display interstitial or video use Appodeal.show(this, Appodeal.INTERSTITIAL | Appodeal.SKIPPABLE_VIDEO)

To display banner at the bottom of the screen use Appodeal.show(this, Appodeal.BANNER_BOTTOM)

To display banner at the top of the screen use Appodeal.show(this, Appodeal.BANNER_TOP)

To display banner at the center of the screen use Appodeal.show(this, Appodeal.BANNER_CENTER)

To display banner in the view specified in layout file use Appodeal.show(this, Appodeal.BANNER_VIEW)

To display banner 300*250 you need to call the following code in activity: Appodeal.show(this, Appodeal.MREC)

To display ad with placement you need to call the following code in activity:

Appodeal.show(this, adTypes, placementName);

Hiding banner

To hide banner you need to call the following code in activity:

Appodeal.hide(this, Appodeal.BANNER);

To hide 300*250 banner you need to call the following code in activity:

Appodeal.hide(this, Appodeal.MREC);

Native ads

Caching native

To cache native ads use:

Appodeal.cache(this, Appodeal.NATIVE);

Caching multiple native ads

To cache multiple native ads use:

Appodeal.cache(this, Appodeal.NATIVE, 3);

The number of cached ads is not guarantied and could be less than requested.

Native ads callbacks

Appodeal.setNativeCallbacks(new NativeCallbacks() {
  @Override
  public void onNativeLoaded(List<NativeAd> nativeAds) { Log.d("Appodeal", "onNativeLoaded"); }
  @Override
  public void onNativeFailedToLoad() { Log.d("Appodeal", "onNativeFailedToLoad"); }
  @Override
  public void onNativeShown(NativeAd nativeAd) { Log.d("Appodeal", "onNativeShown"); }
  @Override
  public void onNativeClicked(NativeAd nativeAd) { Log.d("Appodeal", "onNativeClicked"); }
});

Image caching

To disable caching of native icons or images/video if you are not planning to use both use the following methods before native ads initialization:

Appodeal.setAutoCacheNativeIcons(false);
Appodeal.setAutoCacheNativeMedia(false);

Native video

To show video native ads you should add AppodealMediaView to native ad layout

AppodealMediaView appodealMediaView = (AppodealMediaView) adView.findViewById(R.id.appodeal_media_view_content);
if (nativeAd.containsVideo()) {
    nativeAd.setAppodealMediaView(appodealMediaView);
} else {
   appodealMediaView.setVisibility(View.GONE);
}

Native video settings

To control wether you want to show video native ads use the following methods:

Appodeal.setNativeAdType(Native.NativeAdType.Auto) - both static image and video native ads will be loaded

Appodeal.setNativeAdType(Native.NativeAdType.NoVideo) - only static image native ads will be loaded

Appodeal.setNativeAdType(Native.NativeAdType.Video) - only video native ads will be loaded

NativeAd object

After native ads are cached using Appodeal.cache() list of NativeAd objects are returned in onNativeLoaded callback. NativeAd object has the following methods:

nativeAd.getTitle() - String: Title of native ad. Mandatory. Minimum 25 symbols of title should always be displayed. You can add ellipsis at the end if the title is longer.

nativeAd.getCallToAction() - String: Call to action text. Mandatory. Shoud be displayed without truncation on a visible button.

nativeAd.getDescription() - String: Text description of native ad. Optional. If you choose to display the description you should display minimum 75 characters. You should limit number of lines displayed suitable for your app. You can add ellipsis at the end.

nativeAd.getRating() - Float: Rating of the app in [0-5] range.

nativeAd.getAgeRestrictions() - String. App age restriction. Optional, may return null.

nativeAd.getIcon() - Bitmap: Icon. Either icon or image is mandatory to display.

nativeAd.getImage() - Bitmap: Image. Either icon or image is mandatory to display.

getIconUrl() - String. Returns URL of the Icon. Disable automatic caching of icons using Appodeal.setAutoCacheNativeIcons(false) if you are planning on caching icons yourself

getImageUrl() - String. Returns URL of the Image. Disable automatic caching of images using Appodeal.setAutoCacheNativeMedia(false) if you are do not want to use images/video

nativeAd.getProviderView(context) - View: If returned view is not null it is mandatory to display it in any corner of native ad. Only used for Facebook to display AdChoices icon.

nativeAd.registerViewForInteraction(nativeAdView) - Registers native ad view to the native ad to track impressions and process clicks. Mandatory.

nativeAd.unRegisterViewForInteraction() - Unregisters view after native ad is no longer displayed. Mandatory.

nativeAd.setAppodealMediaView(AppodealMediaView) - Registers AppodealMediaView to NativeAd object. Mandatory if videos are used.

nativeAd.containsVideo() - Returns true if NativeAd object contains video

Native ads requirements

All of the fields of native ad marked as mandatory must be displayed.

Every ad should have a sign that clearly indicates that it is an ad. For example "Ad" or "Sposored".

Provided images can be resized to fit your ad space but should not be significantly distorted or cropped.

Templates

Appodeal SDK provides 3 types of templates for native ads:

  • NativeAdViewNewsFeed
  • NativeAdViewAppWall
  • NativeAdViewContentStream

If you want to use one of these templates, you can either add the selected template in the layout:

<com.appodeal.ads.native_ad.views.NativeAdViewNewsFeed
android:id="@+id/native_ad_view_news_feed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp">
</com.appodeal.ads.native_ad.views.NativeAdViewNewsFeed>

<com.appodeal.ads.native_ad.views.NativeAdViewAppWall
android:id="@+id/native_ad_view_app_wall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp">
</com.appodeal.ads.native_ad.views.NativeAdViewAppWall>

<com.appodeal.ads.native_ad.views.NativeAdViewContentStream
android:id="@+id/native_ad_view_content_stream"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp">
</com.appodeal.ads.native_ad.views.NativeAdViewContentStream>

And when ad is received send ad:

NativeAdViewNewsFeed nav_nf = (NativeAdViewNewsFeed) mActivity.findViewById(R.id.native_ad_view_news_feed);
nav_nf.setNativeAd(mNativeAd);

NativeAdViewAppWall nav_aw = (NativeAdViewAppWall) mActivity.findViewById(R.id.native_ad_view_app_wall);
nav_aw.setNativeAd(mNativeAd);

NativeAdViewContentStream nav_cs = (NativeAdViewContentStream) mActivity.findViewById(R.id.native_ad_view_content_stream);
nav_cs.setNativeAd(mNativeAd);

Either create a view programmatically and add it to the screen:

RelativeLayout holder = (RelativeLayout) mActivity.findViewById(R.id.native_template_holder);
NativeAdViewAppWall nativeAdView = new NativeAdViewAppWall(mActivity, mNativeAd);
holder.addView(nativeAdView);

Also available all template elements:

ImageView getImageView()
ImageView getIconView()
TextView getTitleView()
TextView getDescriptionView()
TextView getCallToActionView()
RatingBar getRatingBar()

By default view of native ads are labeled «Ad». You can replace it with «Sponsored»:

showSponsored(Boolean)

To quickly change the color of the standard buttons in the templates available methods:

setCallToActionColor(int color)
setCallToActionColor(String color)

Sample

Appodeal.setAutoCacheNativeIcons(true);
Appodeal.setAutoCacheNativeMedia(false);
Appodeal.initialize(this, APP_KEY, Appodeal.NATIVE);
Appodeal.setNativeCallbacks(new NativeCallbacks() {
    @Override
    public void onNativeLoaded(List<NativeAd> nativeAds) {
        Toast.makeText(MainActivity.this, "onNativeLoaded", Toast.LENGTH_SHORT).show();

        RelativeLayout nativeView = (RelativeLayout) MainActivity.this.findViewById(R.id.native_item);
        NativeAd nativeAd = nativeAds.get(0);

        TextView nativeAdSign = (TextView) nativeView.findViewById(R.id.native_ad_sign);
        nativeAdSign.setText("Ad");

        TextView nativeTitle = (TextView) nativeView.findViewById(R.id.native_title);
        nativeTitle.setText(nativeAd.getTitle());

        TextView nativeDescription = (TextView) nativeView.findViewById(R.id.native_description);
        nativeDescription.setMaxLines(3);
        nativeDescription.setEllipsize(TextUtils.TruncateAt.END);
        nativeDescription.setText(nativeAd.getDescription());

        RatingBar nativeRating = (RatingBar) nativeView.findViewById(R.id.native_rating);
        if (nativeAd.getRating() == 0) {
            nativeRating.setVisibility(View.INVISIBLE);
        } else {
            nativeRating.setVisibility(View.VISIBLE);
            nativeRating.setRating(nativeAd.getRating());
            nativeRating.setIsIndicator(true);
            nativeRating.setStepSize(0.1f);
        }

        Button nativeCta = (Button) nativeView.findViewById(R.id.native_cta);
        nativeCta.setText(nativeAd.getCallToAction());

        ((ImageView) nativeView.findViewById(R.id.native_icon)).setImageBitmap(nativeAd.getIcon());
        ((ImageView) nativeView.findViewById(R.id.native_image)).setImageBitmap(nativeAd.getImage());

        View providerView = nativeAd.getProviderView(MainActivity.this);
        if (providerView != null) {
            FrameLayout providerViewContainer = (FrameLayout) nativeView.findViewById(R.id.native_provider_view);
            providerViewContainer.addView(providerView);
        }

        nativeAd.registerViewForInteraction(nativeView);
        nativeView.setVisibility(View.VISIBLE);
    }

    @Override
    public void onNativeFailedToLoad() {
        Toast.makeText(MainActivity.this, "onNativeFailedToLoad", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onNativeShown(NativeAd nativeAd) {
        Toast.makeText(MainActivity.this, "onNativeShown", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onNativeClicked(NativeAd nativeAd) {
        Toast.makeText(MainActivity.this, "onNativeClicked", Toast.LENGTH_SHORT).show();
    }
});

Samples

Display interstitial after it was loaded

Appodeal.setAutoCache(Appodeal.INTERSTITIAL, false);
Appodeal.initialize(this, appKey, Appodeal.INTERSTITIAL);
Appodeal.cache(this, Appodeal.INTERSTITIAL);
Appodeal.setInterstitialCallbacks(new InterstitialCallbacks() {
  public void onInterstitialLoaded(boolean isPrecache) {
    Appodeal.show(MainActivity.this, Appodeal.INTERSTITIAL);
  }
  public void onInterstitialFailedToLoad() { }
  public void onInterstitialShown() { }
  public void onInterstitialClicked() { }
  public void onInterstitialClosed() { }
});

Display interstitial after app launch

Appodeal.initialize(this, appKey, Appodeal.INTERSTITIAL);
Appodeal.show(this, Appodeal.INTERSTITIAL);

Advanced features

Enabling test mode

Appodeal.setTesting(true);

In test mode test ads will be shown and debug data will be written to logcat

Enabling logging

Appodeal.setLogLevel(Log.LogLevel.debug)

Enable debug logging to logcat using tag "Appodeal"

Checking if ad is loaded

Appodeal.isLoaded(adTypes);

To check if interstitial is loaded use Appodeal.isLoaded(Appodeal.INTERSTITIAL);

To check if skippable video is loaded use Appodeal.isLoaded(Appodeal.SKIPPABLE_VIDEO);

To check if rewarded video is loaded use Appodeal.isLoaded(Appodeal.REWARDED_VIDEO);

To check if non-skippable video is loaded use Appodeal.isLoaded(Appodeal.NON_SKIPPABLE_VIDEO);

To check if banner is loaded use Appodeal.isLoaded(Appodeal.BANNER);

To check if 300*250 banner is loaded use Appodeal.isLoaded(Appodeal.MREC);

Checking if loaded ad is precache

Appodeal.isPrecache(adTypes);

Currently supported only for interstitials, banners and MREC

To check if loaded interstitial is precache use Appodeal.isPrecache(Appodeal.INTERSTITIAL);

To check if loaded banner is precache use Appodeal.isPrecache(Appodeal.BANNER);

To check if loaded MR|EC is precache use Appodeal.isPrecache(Appodeal.MREC);

Setting Interstitial callbacks

Appodeal.setInterstitialCallbacks(new InterstitialCallbacks() {
  private Toast mToast;

  @Override
  public void onInterstitialLoaded(boolean isPrecache) {
    showToast("onInterstitialLoaded");
  }

  @Override
  public void onInterstitialFailedToLoad() {
    showToast("onInterstitialFailedToLoad");
  }

  @Override
  public void onInterstitialShown() {
    showToast("onInterstitialShown");
  }

  @Override
  public void onInterstitialClicked() {
    showToast("onInterstitialClicked");
  }

  @Override
  public void onInterstitialClosed() {
    showToast("onInterstitialClosed");
  }

  void showToast(final String text) {
    if (mToast == null) {
      mToast = Toast.makeText(mActivity, text, Toast.LENGTH_SHORT);
    }
    mToast.setText(text);
    mToast.setDuration(Toast.LENGTH_SHORT);
    mToast.show();
  }
});

Setting skippable video callbacks

Appodeal.setSkippableVideoCallbacks(new SkippableVideoCallbacks() {
  private Toast mToast;

  @Override
  public void onSkippableVideoLoaded() {
    showToast("onSkippableVideoLoaded");
  }

  @Override
  public void onSkippableVideoFailedToLoad() {
    showToast("onSkippableVideoFailedToLoad");
  }

  @Override
  public void onSkippableVideoShown() {
    showToast("onSkippableVideoShown");
  }

  @Override
  public void onSkippableVideoFinished() {
    showToast("onSkippableVideoFinished");
  }

  @Override
  public void onSkippableVideoClosed(boolean finished) {
    showToast(String.format("onSkippableVideoClosed,  finished: %s", finished));
  }

  void showToast(final String text) {
    if (mToast == null) {
      mToast = Toast.makeText(mActivity, text, Toast.LENGTH_SHORT);
    }
    mToast.setText(text);
    mToast.setDuration(Toast.LENGTH_SHORT);
    mToast.show();
  }
});

Setting rewarded video callbacks

Appodeal.setRewardedVideoCallbacks(new RewardedVideoCallbacks() {
  private Toast mToast;
  @Override
  public void onRewardedVideoLoaded() {
    showToast("onRewardedVideoLoaded");
  }
  @Override
  public void onRewardedVideoFailedToLoad() {
    showToast("onRewardedVideoFailedToLoad");
  }
  @Override
  public void onRewardedVideoShown() {
    showToast("onRewardedVideoShown");
  }
  @Override
  public void onRewardedVideoFinished(int amount, String name) {
    showToast(String.format("onRewardedVideoFinished. Reward: %d %s", amount, name));
  }
  @Override
  public void onRewardedVideoClosed(boolean finished) {
    showToast(String.format("onRewardedVideoClosed,  finished: %s", finished));
  }
  void showToast(final String text) {
    if (mToast == null) {
      mToast = Toast.makeText(mActivity, text, Toast.LENGTH_SHORT);
    }
    mToast.setText(text);
    mToast.setDuration(Toast.LENGTH_SHORT);
    mToast.show();
  }
});

Setting non-skippable video callbacks

Appodeal.setNonSkippableVideoCallbacks(new NonSkippableVideoCallbacks() {
  private Toast mToast;
  @Override
  public void onNonSkippableVideoLoaded() {
    showToast("onNonSkippableVideoLoaded");
  }
  @Override
  public void onNonSkippableVideoFailedToLoad() {
    showToast("onNonSkippableVideoFailedToLoad");
  }
  @Override
  public void onNonSkippableVideoShown() {
    showToast("onNonSkippableVideoShown");
  }
  @Override
  public void onNonSkippableVideoFinished() {
    showToast("onNonSkippableVideoFinished");
  }
  @Override
  public void onNonSkippableVideoClosed(boolean finished) {
    showToast(String.format("onNonSkippableVideoClosed,  finished: %s", finished));
  }
  void showToast(final String text) {
    if (mToast == null) {
      mToast = Toast.makeText(mActivity, text, Toast.LENGTH_SHORT);
    }
    mToast.setText(text);
    mToast.setDuration(Toast.LENGTH_SHORT);
    mToast.show();
  }
});

Setting banner callbacks

Appodeal.setBannerCallbacks(new BannerCallbacks() {
  private Toast mToast;

  @Override
  public void onBannerLoaded(int height, boolean isPrecache) {
    showToast(String.format("onBannerLoaded, %ddp", height));
  }

  @Override
  public void onBannerFailedToLoad() {
    showToast("onBannerFailedToLoad");
  }

  @Override
  public void onBannerShown() {
    showToast("onBannerShown");
  }

  @Override
  public void onBannerClicked() {
    showToast("onBannerClicked");
  }

  void showToast(final String text) {
    if (mToast == null) {
      mToast = Toast.makeText(mActivity, text, Toast.LENGTH_SHORT);
    }
    mToast.setText(text);
    mToast.setDuration(Toast.LENGTH_SHORT);
    mToast.show();
  }
});

Setting 300*250 banner callbacks

Appodeal.setMrecCallbacks(new MrecCallbacks() {
  private Toast mToast;

  @Override
  public void onMrecLoaded(boolean isPrecache) {
    showToast("onMrecLoaded");
  }

  @Override
  public void onMrecFailedToLoad() {
    showToast("onMrecFailedToLoad");
  }

  @Override
  public void onMrecShown() {
    showToast("onMrecShown");
  }

  @Override
  public void onMrecClicked() {
    showToast("onMrecClicked");
  }

  void showToast(final String text) {
    if (mToast == null) {
      mToast = Toast.makeText(mActivity, text, Toast.LENGTH_SHORT);
    }
    mToast.setText(text);
    mToast.setDuration(Toast.LENGTH_SHORT);
    mToast.show();
  }
});

S2S Reward Callbacks

To secure you apps economy we offer S2S reward callbaks. To validate each reward you need to setup callback URL on your server that will receive reward information. We will pass user data to your callback URL that you will need to validate and adjust user balance accordingly

1. Create reward callback URL on your server that will receive reward information

2. Fill created URL and encryption key in the app settings in your dashboard

3. Reward callback will be sent to your URL using GET request with two parameters:

{http://example.com/reward}?data1={data1}&data2={data2}

4. Your URL should decrypt the data and validate it

5. Check impression_id for uniqueness and store it in your system to prevent duplicate transactions

We offer sample script in PHP, Ruby, Java and Python 3 to decrypt the data. If you need samples in other languages please contact our support and we will provide it for you.

Sample in PHP: reward.php

Sample in Ruby: reward.rb

Sample in Java: Reward.java

Sample in Python 3: reward.py

Native ad templates

We support 3 different native ad templates:

News Feed

NativeAdViewNewsFeed navNF = (NativeAdViewNewsFeed) mActivity.findViewById(R.id.native_ad_view_news_feed);
navNF.setNativeAd(nativeAd);

App Wall

NativeAdViewAppWall navAW = (NativeAdViewAppWall) mActivity.findViewById(R.id.native_ad_view_app_wall);
navAW.setNativeAd(nativeAd);

Content Stream

NativeAdViewContentStream navCS = (NativeAdViewContentStream) mActivity.findViewById(R.id.native_ad_view_content_stream);
navCS.setNativeAd(nativeAd);

Manual ad caching

Appodeal.cache((Activity)this, adTypes);

You should disable automatic caching before SDK initialization using setAutoCache(adTypes, false);.

To cache interstitial use Appodeal.cache(this, Appodeal.INTERSTITIAL);

To cache skippable video use Appodeal.cache(this, Appodeal.SKIPPABLE_VIDEO);

To cache rewarded video use Appodeal.cache(this, Appodeal.REWARDED_VIDEO);

To cache non-skippable video use Appodeal.cache(this, Appodeal.NON_SKIPPABLE_VIDEO);

To cache interstitial and video use Appodeal.cache(this, Appodeal.INTERSTITIAL | Appodeal.SKIPPABLE_VIDEO);

To cache banner use Appodeal.cache(this, Appodeal.BANNER);

To cache 300*250 banner use Appodeal.cache(this, Appodeal.MREC);

To cache native ads use Appodeal.cache(this, Appodeal.NATIVE);

Enabling or disabling automatic caching

Appodeal.setAutoCache(adTypes, false);

Should be used before SDK initialization

To disable automatic caching for interstitials use Appodeal.setAutoCache(Appodeal.INTERSTITIAL, false);

To disable automatic caching for skippable videos use Appodeal.setAutoCache(Appodeal.SKIPPABLE_VIDEO, false);

To disable automatic caching for rewarded videos use Appodeal.setAutoCache(Appodeal.REWARDED_VIDEO, false);

To disable automatic caching for non-skippable videos use Appodeal.setAutoCache(Appodeal.NON_SKIPPABLE_VIDEO, false);

To disable automatic caching for banners use Appodeal.setAutoCache(Appodeal.BANNER, false);

To disable automatic caching for native ads use Appodeal.setAutoCache(Appodeal.NATIVE, false);

Triggering onLoaded callback twice

Appodeal.setOnLoadedTriggerBoth(adTypes, true);

Currently supported only for interstitials, banners and MREC

setOnLoadedTriggerBoth(Appodeal.INTERSTITIAL | Appodeal.BANNER, false); - onInterstitialLoaded and onBannerLoaded will trigger only when normal ad was loaded (default).

setOnLoadedTriggerBoth(Appodeal.INTERSTITIAL | Appodeal.BANNER, true); - onInterstitialLoaded and onBannerLoaded will trigger twice, both when precache and normal ad were loaded.

Should be used before SDK initialization

Display banners in a view

Add com.appodeal.ads.BannerView to your layout file:

<com.appodeal.ads.BannerView 
  android:id="@+id/appodealBannerView" 
  android:layout_width="match_parent" 
  android:layout_height="wrap_content" 
  android:visibility="gone" />

Set view id before SDK initialization

Appodeal.setBannerViewId(R.id.appodealBannerView);

Now you can show banner in the view specified:

Appodeal.show(this, Appodeal.BANNER_VIEW);

Using programmatically created banner view

Create banner view

Appodeal.getBannerView(this);

Add view to your layout and than show banner in it:

Appodeal.show(this, Appodeal.BANNER_VIEW);

Display 300*250 banners

Add com.appodeal.ads.MrecView to your layout file:

<com.appodeal.ads.MrecView
  android:id="@+id/appodealMrecView"
  android:layout_width="300dp"
  android:layout_height="250dp"
  android:layout_centerInParent="true"
  android:visibility="gone" />

Set view id before SDK initialization

Appodeal.setMrecViewId(R.id.appodealMrecView);

Now you can show banner in the view specified:

Appodeal.show(this, Appodeal.MREC);

Using programmatically created 300*250 banner view

Create banner view

Appodeal.getMrecView(this);

Add view to your layout and than show banner in it:

Appodeal.show(this, Appodeal.MREC);

Handling orientation change

If your activity is recreated on screen rotation banner will disappear. To prevent that you need to call the following method in onResume of your activity:

@Override
public void onResume() {
  super.onResume();
  Appodeal.onResume(this, Appodeal.BANNER);
  Appodeal.onResume(this, Appodeal.MREC);
}

Disabling networks

Appodeal.disableNetwork((Context)this, (String)network);

Available parameters: "amazon_ads", "applovin", "chartboost", "mopub", "unity_ads", "mailru", "facebook", "adcolony", "vungle", "yandex", "startapp", "avocarrot", "flurry", "pubnative", "cheetah", "inner-active", "revmob".

Should be used before SDK initialization

Disabling networks

Appodeal.disableNetwork((Context)this, (String)network, adTypes);

Remove adapters from Project

Appodeal.disableNetwork(this, "startapp", Appodeal.BANNER | Appodeal.INTERSTITIAL);

Disabling location permission check

To disable toast messages ACCESS_COARSE_LOCATION permission is missing use the following method:

Appodeal.disableLocationPermissionCheck();

Should be used before SDK initialization.

Disabling write external storage permission check.

To disable toast messages WRITE_EXTERNAL_STORAGE permission is missing use the following method:

Appodeal.disableWriteExternalStoragePermissionCheck();

Disables all ad networks that need this permission may lead to low video fillrates

Should be used before SDK initialization

Tracking in-app purchase

Appodeal.trackInAppPurchase((Context) this, amount, currencyCode);

Tracks in-app purchase information and sends info to our servers for analytics. Example:

Appodeal.trackInAppPurchase(this, 5, "USD");

Disabling smart banners

Appodeal.setSmartBanners(false);

Disables smart banners, enabled by default

Setting user data.

Initialization

Our SDK provides the transfer of user data for better ad targeting and higher eCPM. All parameters are optional and can be defined partially.

To obtain reference to the user settings, please call this before Appodeal initialization:

UserSettings userSettings = Appodeal.getUserSettings(this);

Set the age of the user

Positive integer value.

userSettings.setAge(25);

Set birth date

userSettings.setBirthday("17/06/1990");

birthday in format "DD/MM/YYYY" or "MM/YYYY" or "YYYY"

Set user email

userSettings.setEmail("hi@appodeal.com");

Specify gender of the user

userSettings.setGender(UserSettings.Gender.FEMALE);

Possible values: UserSettings.Gender.FEMALE, UserSettings.Gender.MALE, UserSettings.Gender.OTHER.

Set interests of the user

userSettings.setInterests("reading, games, movies, snowboarding");

Specify occupation of the user

userSettings.setOccupation(UserSettings.Occupation.WORK);

Possible values: UserSettings.Occupation.WORK, UserSettings.Occupation.UNIVERSITY, UserSettings.Occupation.SCHOOL, UserSettings.Occupation.OTHER

Specify marital status of the user

userSettings.setRelation(UserSettings.Relation.DATING);

Possible values: UserSettings.Relation.DATING, UserSettings.Relation.ENGAGED, UserSettings.Relation.MARRIED, UserSettings.Relation.SEARCHING, UserSettings.Relation.SINGLE, UserSettings.Relation.OTHER

Set drinking habits of the user

userSettings.setAlcohol(UserSettings.Alcohol.NEGATIVE);

Possible values: UserSettings.Alcohol.NEGATIVE, UserSettings.Alcohol.NEUTRAL, UserSettings.Alcohol.POSITIVE.

User attitude to smoking

userSettings.setSmoking(UserSettings.Smoking.NEGATIVE);

Possible values: UserSettings.Smoking.NEGATIVE, UserSettings.Smoking.POSITIVE, UserSettings.Smoking.NEUTRAL.

Segments and placements

Segments are divisions of your user base, which share commonalities such as age, sex, location, interests, income bracket, etc. There are several ways to segment users into groups including the use of demographics, in-app behavior or engagement analysis, interests and personal profile data, and location.

Once user segments have been created, they can then be analyzed and used to configure ads.

To create new segment go here

1) Enter it's name

2) Select match rule:

  • ALL - user will only match to segment if all of the rules will apply to them
  • ANY - user will match to segment if any of the rules will apply to them

3) Select platform

4) Select rules that apply to the user, you can select as many rules as you want or none at all:

  • App - match users in one or multiple of your apps
  • SDK version - match users that only use specified sdk version or range of versions
  • Device type - match users that using tablet and/or phone
  • App version - match users that only use specified app version or range of versions
  • Country - match users only from specified countries
  • OS version - match users that are using devices with specified Android
  • Has app installed - only match users that have specified apps installed
  • Session count - match users that had specified number of sessions in your app
  • Average session length - match users with specified that spent specified average session length in your app
  • Device model - match user on specified devices
  • Connection type - match users using specified connection type
  • Gender, Age, Occupation, Relation - matches users with specified Gender, Age, Occupation, Relation
  • Last session time - matches users that last used your app at the specified time
  • Bought inapps - matches users that made in app purchases(tracked using Appodeal.trackInAppPurchase method)
  • Inapp sum, Inapp sum all apps - matches users the spent specified amount in your the app or all apps (only counts inapps tracked using Appodeal.trackInAppPurchase method)
  • Hour, Day - matches users using the app at the specified time
  • Int, Float, String, Bool - matches users using custom parameters. You can set custom parameters in SDK using Appodeal.setCustomRule method, i.e. Appodeal.setCustomRule("levels_played", 3). To match users that played more than 3 level select Int and enter name "levels_played", select operator > and value 3

5) Segment settins. You can apply following settings for each segment, they will apply to all users matched to that segment.

  • Disable networks. Allows you to disable any network for ant ad type it supports
  • Min pricefloor. Allows you to set minimum price floor for each ad type. Ads with eCPM lower then price floor will not be filled.
  • Overriden eCPM. Allows you to override eCPM of each network for ad type. High eCPM(100+) will ensure that the network will be at the top of the waterfall and get the first fill. Low eCPM (close to 0) will ensure that the network acts as backfill

If you have no segments all users will be matched to hidden default segment

If you have multiple segments their order is important. Only the first segment in which rules are matched to the user will apply, all of the rest will be ignored.

Placements

Appodeal SDK allows you to tag each impression with different placement.

To show an ad with placement you have to call show method like this:

Appodeal.show(this, adTypes, placementName);

Placement can be used for separating your revenue by placement in our dashboard and determining which placement earns you more money

Also you can configure your impression logic for each placement. You can use the following Placement settings:

  • Disable ads - disables ads completely for that placement
  • Disable as types - disables specific ad type for a placement. If you integrated to show Appodeal.INTERSTITIAL | Appodeal.SKIPPABLE_VIDEO you can disable interstitials or skippable video for the placement
  • Reward - you can set a reward amount and name which will be passed in onRewardedVideoFinished callback for all videos shown with this placement
  • Impression/Refresh period - you can set impression period (in seconds) for interstitials, skippable and rewarded video shown with the placement. If the period between two impression is less than impression period second impression will not be shown and Appodeal.show method will return false. For banners and MRECs you can set their refresh period
  • Min pricefloor - Allows you to set minimum price floor for each ad type. Ads with eCPM lower then price floor will not be shown and Appodeal.show method will return false.

Placements can only be used as part of existing segment. If you only want to use placements create one segment for each platform without any rules and match rule ALL, all of your users will match to it.

If you have no placement, or call Appodeal.show with placement that do not exist or without placement in your segment the impression will be tagged with 'default' placement and it's settings will be applied

You can check more examples here

Proguard settings

If you are using Proguard

If you are using Proguard add the following to your Proguard config file:

# Appodeal
-keep class com.appodeal.** { *; }
-keep class org.nexage.** { *; }
-keepattributes EnclosingMethod, InnerClasses, Signature, JavascriptInterface

# Amazon
-keep class com.amazon.** { *; }
-dontwarn com.amazon.**

# Mopub
-keep public class com.mopub.**
-keepclassmembers class com.mopub.** { public *; }
-keep class * extends com.mopub.mobileads.CustomEventBanner {}
-keep class * extends com.mopub.mobileads.CustomEventInterstitial {}
-keep class * extends com.mopub.nativeads.CustomEventNative {}
-keep class * extends com.mopub.mobileads.CustomEventRewardedVideo {}
-dontwarn com.mopub.volley.toolbox.**

# Applovin
-keep class com.applovin.** { *; }
-dontwarn com.applovin.**

# Facebook
-keep class com.facebook.ads.** { *; }
-dontwarn com.facebook.ads.**

# Chartboost
-keep class com.chartboost.** { *; }
-dontwarn com.chartboost.**

# Unity Ads
-keepattributes JavascriptInterface
-keepattributes SourceFile,LineNumberTable
-keep class com.unity3d.** { *; }

# Yandex
-keep class com.yandex.metrica.** { *; }
-dontwarn com.yandex.metrica.**
-keep class com.yandex.mobile.ads.** { *; }
-dontwarn com.yandex.mobile.ads.**
-keepattributes *Annotation*

# StartApp
-keep class com.startapp.** { *;}
-dontwarn com.startapp.**
-keepattributes Exceptions, InnerClasses, Signature, Deprecated, SourceFile, LineNumberTable, *Annotation*, EnclosingMethod

# Flurry
-keep class com.flurry.** { *; }
-dontwarn com.flurry.**
-keepattributes *Annotation*,EnclosingMethod,Signature
-keepclasseswithmembers class * {
  public <init>(android.content.Context, android.util.AttributeSet, int);
}

# Avocarrot
-keep class com.avocarrot.** { *; }
-keepclassmembers class com.avocarrot.** { *; }
-dontwarn com.avocarrot.**
-keep public class * extends android.view.View {
  public <init>(android.content.Context);
  public <init>(android.content.Context, android.util.AttributeSet);
  public <init>(android.content.Context, android.util.AttributeSet, int);
  public void set*(...);
}

# Adcolony
-keep class com.jirbo.adcolony.** { *;}
-keep class com.immersion.** { *;}
-dontnote com.immersion.**
-dontwarn android.webkit.**
-dontwarn com.jirbo.adcolony.**

# Vungle
-keep class com.vungle.** { public *; }
-keep class javax.inject.*
-keepattributes *Annotation*, Signature
-keep class dagger.*
-dontwarn com.vungle.**

# MyTarget
-keep class com.my.target.** { *; }
-dontwarn com.my.target.**
-keep class ru.mail.android.mytarget.** { *; }
-dontwarn ru.mail.android.mytarget.**

#Cheetah Mobile
-keep class com.cmcm.** { *; }
-dontwarn com.cmcm.**

# Tapjoy
-keep class com.tapjoy.** { *; }
-dontwarn com.tapjoy.**

# Revmob
-keep class com.revmob.** { *; }
-dontwarn com.revmob.**

# Admob
-keep class com.google.android.gms.ads.** { *; }

# Google
-keep class com.google.android.gms.common.GooglePlayServicesUtil {*;}
-keep class com.google.android.gms.ads.identifier.** { *; }
-dontwarn com.google.android.gms.**

# Legacy
-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**
-dontwarn android.net.http.**

# Google Play Services library
-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}
-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
  public static final *** NULL;
}
-keepnames class * implements android.os.Parcelable
-keepclassmembers class * implements android.os.Parcelable {
  public static final *** CREATOR;
}
-keep @interface android.support.annotation.Keep
-keep @android.support.annotation.Keep class *
-keepclasseswithmembers class * {
  @android.support.annotation.Keep <fields>;
}
-keepclasseswithmembers class * {
  @android.support.annotation.Keep <methods>;
}
-keep @interface com.google.android.gms.common.annotation.KeepName
-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
  @com.google.android.gms.common.annotation.KeepName *;
}
-keep @interface com.google.android.gms.common.util.DynamiteApi
-keep public @com.google.android.gms.common.util.DynamiteApi class * {
  public <fields>;
  public <methods>;
}
-keep class com.google.android.gms.common.GooglePlayServicesNotAvailableException {*;}
-keep class com.google.android.gms.common.GooglePlayServicesRepairableException {*;} 

# Google Play Services library 9.0.0 only
-dontwarn android.security.NetworkSecurityPolicy
-keep public @com.google.android.gms.common.util.DynamiteApi class * { *; }

# support-v4
-keep class android.support.v4.app.Fragment { *; }
-keep class android.support.v4.app.FragmentActivity { *; }
-keep class android.support.v4.app.FragmentManager { *; }
-keep class android.support.v4.app.FragmentTransaction { *; }
-keep class android.support.v4.content.LocalBroadcastManager { *; }
-keep class android.support.v4.util.LruCache { *; }
-keep class android.support.v4.view.PagerAdapter { *; }
-keep class android.support.v4.view.ViewPager { *; }
-keep class android.support.v4.content.ContextCompat { *; }

# support-v7-recyclerview
-keep class android.support.v7.widget.RecyclerView { *; }
-keep class android.support.v7.widget.LinearLayoutManager { *; }

Admob Adapter

Admob adapter for Appodeal is included with our jar.

To use it do the following:

1. Go to your adUnit, click on “Mediation ad sources”

2. Add New ad network

3. Add new Custom Event:

Class Name - com.google.ads.mediation.appodeal.AppodealCustomEvent

Label - AppodealCustomEvent

Parameter - fee50c333ff3825fd6ad6d38cff78154de3025546d47a84f

Admob1
Admob2

MoPub Adapter

MoPub adapter for Appodeal is included with our jar.

To use it do the following:

1. On the MoPub Networks page click “Add Network”

2. Choose “Custom Native Network”

3. Enter the Custom Event Class information into the text boxes.

Custom Event Class - com.mopub.mobileads.AppodealCustomEventInterstitial

Custom Event Class Data - {"appKey":"fee50c333ff3825fd6ad6d38cff78154de3025546d47a84f"}

Mopub1
Mopub2

Changelog

1.15.7 (Oct 10, 2016)

  • Small fixes

1.15.6 (Oct 5, 2016)

  • Adding setLogLevel method. Available parameters: LogLevel.none, LogLevel.debug, LogLevel.verbose
  • Removing setLogging method
  • Chartboost integration fixes
  • Adding day and hour segment rules
  • Updating Proguard

1.15.5 (Sep 21, 2016)

  • Updating Unity Ads to 2.0.4

1.15.4 (Sep 16, 2016)

  • Integrating Revmob: banners, interstitials, skippable videos, rewarded videos
  • Adding per placement price floors
  • Banner change animation optimization
  • Performance optimizations
  • Updating Unity Ads to 2.0.2. AAR is no longer needed
  • Updating Proguard
  • Updating AndroidManifest

1.15.3 (Sep 6, 2016)

  • Fixing GoogleApiAvailability NoClassDefFoundError on old Google Play Services during initialization
  • Fixing rare crashes in VASTActivity
  • Renaming setCustomSegment to setCustomRule
  • Adding rewarded videos from Tapjoy. Do not forget to add new activities in AndroidManifest
  • Adding support for refresh period in banners and MRECs configured using placements
  • Sending pricefloor on impression with our offers to improve second price calculation
  • Minor fixes
  • Updating Avocarrot to 3.7.3
  • Updating Tapjoy to 11.8.0
  • Updating MyTarget to 4.5.10
  • Updating Chartboost to 6.5.1
  • Updating Amazon Ads to 5.8.1
  • Updating Applovin to 6.3.0
  • Updating Flurry to 6.5.0

1.15.2 (Aug 12, 2016)

  • Fixing NPE in cases where some network SDKs are not present

1.15.1 (Aug 08, 2016)

  • Removing Inmobi SDK. Do not forget to remove inmobi receivers from manifest
  • Adding support of videos from MyTarget
  • Dex loading improvements
  • Keeping screen on during video playback
  • Adding support for disabling network by ad type in segments
  • Adding container interface for native ads
  • Updating Unity Ads to 1.5.8
  • Updating Adcolony to 2.3.6
  • Update MyTarget to 4.5.6
  • Updating Startapp to 3.4.3
  • Updating Applovin to 6.2.4
  • Adding Cheetah Mobile Ads SDK

1.15 (June 24, 2016, Internal)

  • Adding video native ads. Use AppodealMediaView to show video in your native ads
  • Adding setAppodealMediaView and containsVideo methods to NativeAd object
  • Adding Appodeal.setNativeAdType method to change video native ads settings
  • Renaming setAutoCacheNativeImages to setAutoCacheNativeMedia
  • Updating segment when using setCustomSegment method
  • Fixes
  • Updating Mopub to 5.7.1
  • Updating MyTarget to 4.5.0
  • Updating Avocarrot to 3.7.2
  • Updating Facebook to 4.12.1
  • Removing setVkId and setFacebookId methods from UserSettings
  • Adding com.appodeal.ads.VideoPlayerActivity to manifest

1.14.15 (June 17, 2016)

  • Adding setSmartBanners method to enable/disable smart banners (Enabled by default)
  • Adding set728x90Banners method to enable/disable 728*90 banners (Disabled by default)
  • Minor fixes
  • Adding banner and mrec precache
  • onBannerLoaded(int height) -> onBannerLoaded(int height, boolean isPrecache). setOnLoadedTriggerBoth, isPrecache
  • onMrecLoaded() -> onMrecLoaded(boolean isPrecache). setOnLoadedTriggerBoth, isPrecache
  • Adding autocaching in native ads, enabled by default. One ad is requested after initialization. setAutoCache
  • Support for campaign frequency for cross promo
  • Performance optimization
  • Removing Appodeal.BANNER_CENTER
  • Fixes:
  • Updating Inmobi to 5.3.1
  • Updating Yandex Ads to 2.12
  • Updating Vungle to 3.3.5
  • Updating Startap to 3.4.2
  • Updating Applovin to 6.2.2
  • Updating Mopub to 4.6.1
  • Updating Amazon to 5.7.2
  • Updating Facebook to 4.12
  • Updating MyTarget to 4.5.1. Rename ru.mail.android.mytarget.ads.MyTargetActivity activity to com.my.target.ads.MyTargetActivity. Fixes the issue with URL credentials alert in Google Play
  • Updating Avocarrot to 3.7.0
  • Changing Proguard

1.14.14 (May 04, 2016)

  • Adding setSmartBanners method to enable/disable smart banners (Enabled by default)
  • Adding set728x90Banners method to enable/disable 728*90 banners (Disabled by default)
  • Minor fixes

1.14.13 (May 01, 2016)

  • Adding boolean flag to onSkippableVideoClosed, onRewardedVideoClosed, onNonSkippableVideoClosed which equals true if video was finished
  • Updating YandexMetrica to 2.41 and YandexAds to 2.11. Do not forget to change metrica:api:level in AndroidManifest to 44
  • Updating Amazon to 5.7.1.1
  • Updating Inmobi to 5.3.0
  • Updating Avocarrot to 3.6.1
  • Updating Adcolony to 2.3.5
  • Integarting Applovin native ads over API
  • Removing isLoadedWithPriceFloor method
  • Fixes to banner refresh animation
  • AndroidManifest changes
  • Proguard changes
  • Minor fixes

1.14.12 (April 10, 2016)

  • Minor fixes

1.14.11 (April 4, 2016)

  • Adding Appodeal.disableWriteExternalStoragePermissionCheck() method. Disables all ad networks that need this permission may lead to low video fillrate
  • Adding toast on initialization if support-v7-recyclerview is missing for native ads
  • Adding getAgeRestrictions method for native ads. Optional, may return null
  • Cleaning video cache automatically
  • Adding video, interstitials and banner from Flurry
  • Keeping screen on during video playback
  • Updating Startapp to 3.3.2
  • Updating Avocarrot to 3.6.0
  • Updating Facebook to 4.10.1
  • Updating Mailru to 4.3.10
  • Updating Yandex Metrica to 2.32 and Yandex Ads to 2.02. Do not forget to change metrica:api:level in AndroidManifest
  • Updating Chartboost to 6.4.1
  • Updating Adcolony to 2.3.4
  • Updating MoPub to 4.5.0
  • Updating android-support-v4 to 23.1.1
  • Updating android-support-v7-recyclerview to 23.1.1
  • Removing Pubnative aar and integrating over API
  • AndroidManifest changes
  • Minor fixes

1.14.10 (March 14, 2016)

  • Minor fixes
  • Updating Inmobi to 5.2.3

1.14.9 (March 7, 2016)

  • Native ads fixes

1.14.8 (February 26, 2016)

  • Minor fixes

1.14.7 (February 22, 2016, Internal)

  • Performance improvements
  • Replacing Liverail with Facebook, do not forget to update your AndroidManifest.xml
  • Native ads fixes
  • Updating Startapp to 3.3.1
  • Updating Vungle to 3.3.4
  • Updating Mailru to 4.3.6
  • Updating Yandex to 2.01
  • Updating Chartboost to 6.3.0
  • Updating Inmobi to 5.2.1
  • Removing showWithPriceFloor(soon to be replaced with placements)
  • unRegisterViewForInteraction no longer requires View as argument

1.14.6 (January 30, 2016)

  • Minor fixes

1.14.5 (January 29, 2016)

  • Minor fixes

1.14.4 (January 27, 2016, Internal)

  • Adding native templates
  • Minor fixes

1.14.3 (January 23, 2016, Internal)

  • Adding MoPub Banner Adapter
  • Updating Avocarrot to 3.5.4
  • Minor fixes

1.14.2 (January 20, 2016)

  • Small fixes
  • Adding new entries to Proguard
  • Adding new entries to AndroidManifest

1.14.1 (January 18, 2016, Internal)

  • Updating Chartboost to 6.2.0
  • Updating Inmobi to 5.2.0
  • Updating YandexMetrica to 2.30 and YandexAds to 2.00
  • Updating Flurry to 6.2.0

1.14 (January 10, 2016, Internal)

  • Adding native ads, Appodeal.NATIVE
  • Adding 300*250 banners, Appodeal.MREC
  • Updating Applovin to 6.1.5
  • Updating Avocarrot to 3.5.3
  • Updating Startapp to 3.3.0
  • Updating Mailru to 4.2.0
  • Updating UnityAds to 1.5.6
  • Updating MoPub to 4.3.3
  • Bug fixes

1.13.11 (December 7, 2015, Internal)

  • Improving video fillrate
  • Adding rewarded video from MoPub
  • Removing Appodeal.ALL constant
  • Renaming Appodeal.VIDEO to Appodeal.SKIPPABLE_VIDEO
  • Renaming VideoCallbacks to SkippableVideoCallbacks
  • Adding Appodeal.NON_SKIPPABLE_VIDEO alias for Appodeal.REWARDED_VIDEO
  • Adding NonSkippableVideoCallbacks
  • Adding alert dialog when using Appodeal.NON_SKIPPABLE_VIDEO, to disable use Appodeal.confirm(Appodeal.SKIPPABLE_VIDEO)
  • Updating Chartboost to 6.1.0
  • Updating Liverail to 4.7.0
  • Bug fixes

1.13.10 (November 18, 2015)

  • Fixing issue with rewarded video were onVideoFinished callback will not trigger in some cases
  • Renaming rewarded video callbacks:
  • onVideoLoaded -> onRewardedVideoLoaded
  • onVideoFailedToLoad -> onRewardedVideoFailedToLoad
  • onVideoShown -> onRewardedVideoShown
  • onVideoFinished -> onRewardedVideoFinished
  • onVideoClosed -> onRewardedVideoClosed

1.13.9 (November 14, 2015)

  • Adding banner fadeout animation
  • Updating Mailru to 4.1.2
  • Updating Startapp to 3.2.2
  • Updating Vungle to 3.3.3
  • Updating Chartboost to 6.0.2 (Make sure to copy CBImpressionActivity from AndroidManifest docs)
  • Fixing issues with Liverail banners and interstitials crashes
  • Proguard changes
  • Various fixes

1.13.7 (October 27, 2015)

  • Removing default Appodeal.initialize(activity, appKey) method, use Appodeal.initialize(activity, appKey, adTypes) method instead. To initialize banner, interstitials and rewarded video use Appodeal.initialize(activity, appKey, Appodeal.BANNER | Appodeal.INTERSTITIAL | Appodeal.REWARDED_VIDEO)
  • Various fixes

1.13.6 (October 23, 2015, Internal)

  • Adding Appodeal.trackInAppPurchase() method
  • Adding Liverail video
  • Various fixes

1.13.5 (October 19, 2015, Internal)

  • Adding separate ad type Appodeal.REWARDED_VIDEO for rewarded videos
  • Android M support
  • Triggering onLoad callback when cache is called if ad is already loaded
  • Adding Appodeal.setLogging(true) method to enable logging
  • Appodeal.disableNetwork() method now accepts optional adType and allows to diable specific network for on or more ad types. Should be used before initialization
  • Adding StartApp interstitials, banners and rewarded videos
  • Adding Yandex interstitials and banners
  • Adding Inneractive interstitials and banners
  • Adding rewarded video from Vungle
  • Replacing Facebook with LiveRail, do not forget to remove facebook.jar
  • Using separate dex file for each ad network
  • Updating Applovin to 6.1.4
  • Updating Mailru to 4.1.1
  • Updating MoPub to 4.0.0
  • Updating Unity Ads to 1.5.3
  • Adding new entries to Proguard
  • Adding new entries to AndroidManifest
  • Fixing bug when banners sometimes would appear on screen rotate
  • Various fixes

1.13.1 (August 18, 2015)

  • Small fixes

1.13 (August 14, 2015, Internal)

  • General:
  • Decreasing network traffic from and to Appodeal servers
  • Appodeal.cache() method will not work if autocache is enabled
  • Appodeal.show(INTERSTITIAL | VIDEO) will show 3s loader if ad is not cached yet
  • Impression and click stats will not be tracked when test mode is enabled
  • support-v4 library is now needed
  • Loading new networks from dex file to solve 65k method limit
  • Context added as first argument of Appodeal.disableNetwork() method.
  • Interstitials:
  • Adding Facebook and Appnexus interstitials
  • Banners:
  • Adding Facebook and Appnexus banners
  • Removing Applovin banners
  • Caching next banner after show
  • Refreshing Admob smart banner on orientation change
  • Video:
  • Adding unskippable videos support. To change which videos to show go to app settings in dashboard.
  • Adding rewarded video from Chartboost, Applovin and UnityAds
  • Adding unskippable video from MoPub
  • Adding Vungle support (Only skippable)
  • Adding Andcolony support (Skippable and V4VC)
  • Adding video without end screen banner support (Currently only from MoPub). To change which videos to show go to app settings in dashboard.
  • Fixes to increase video fillrate
  • Libraries updates:
  • Updating Chartboost to 5.5.3
  • Updating Applovin to 6.0.1
  • Updating MoPub to 3.10.0
  • Fixes:
  • General fillrate fixes
  • Centering fixes in some interstitials

1.12.9 (July 2, 2015, Internal)

  • Updating Unity Ads to 1.4.7
  • Updating Mailru to 4.0.13
  • Fixing MoPub NullPointerException

1.12.8 (June 30, 2015)

  • Small fixes

1.12.7 (June 23, 2015)

  • Updating Unity Ads library to 1.4.4
  • Updating Mailru library to 4.0.11
  • Adding new meta-data entry com.appodeal.framework to AndroidManifest
  • Fixing banner refresh if banner failed to load
  • Banner related fixes

1.12.6 (June 18, 2015)

  • Fixing "for kids" setting
  • Fixing bug related to showing banner in dynamic View

1.12.5 (June 16, 2015)

  • Bug fixes

1.12.4 (June 15, 2015, Internal)

  • Bug fixes

1.12.3 (June 13, 2015, Internal)

  • Adding Mailru banners and interstitials support
  • Adding MoPub video support
  • Adding Applovin video support
  • Removing Supersonic library from SDK. Do not forget to remove Supersonic entries from AndroidManifest.xml
  • Running callbacks on UI thread
  • Adding ability to disable specific ad type from dashboard (coming soon!)
  • Adding Admob banner mediation
  • Adding getBannerView method which return View with banner in it (Call Appodeal.show(this, BANNER_VIEW) after getBannerView)
  • Adding isLoadedWithPriceFloor method for interstitials
  • Adding getVersion method
  • Adding setTesting(true) method to show test ads and write to debug log
  • Renaming method Appodeal.orientationChange to Appodeal.onResume. This method should be called in onResume method of you activity if banner dissappears on orientation change
  • Not showing banner if view wasn't found (BANNER_VIEW only)
  • Updating MoPub library to 3.8.0
  • Updating Chartboost library to 5.4.1
  • Updating Amazon library to 5.6.20
  • Updating Unity Ads library to 1.4.2
  • Banner fillrate fixes
  • Fixing centering in some banners
  • Disabling SDK on devices < 2.3 to prevent crashing
  • Bug fixes

1.12.2 (May 15, 2015)

  • Adding Smaato banners support
  • Adding Appodeal.disableLocationPermissionCheck()
  • Sending video finished stats to server
  • Bug fixes

1.12.1 (May 14, 2015, Internal)

  • Adding MoPub banners support
  • Adding TapSense banners support
  • Bug fixes

1.12 (May 12, 2015, Internal)

  • Adding banners support (Admob, Amazon, Applovin)
  • Adding banners callbacks
  • Adding banners position customization
  • Adding new ad types parameters:
  • Appodeal.BANNER
  • Appodeal.BANNER_BOTTOM
  • Appodeal.BANNER_TOP
  • Appodeal.BANNER_CENTER
  • Appodeal.BANNER_VIEW

1.11.2 (May 4, 2015)

  • Adding ad types parameters:
  • Appodeal.INTERSTITIAL
  • Appodeal.VIDEO
  • Appodeal.ALL and Appodeal.ANY - combination of all currently supported and future ad types
  • Ad types can be combined using "|" operator. For example Appodeal.INTERSTITIAL | Appodeal.VIDEO
  • Appodeal.initialize method will initialize interstitials and videos. To initialize only one use initialize with adType parameter
  • Removing initialization with callbacks. Use setInterstitialCallbacks and setVideoCallbacks
  • Removing showBanner method. Use show with adType parameter
  • Removing cacheBanner method. Use cache with adType parameter
  • Removing showBannerWithPriceFloor method. Use showWithPriceFloor with adType parameter(Currently supported only for interstitials)
  • isLoaded now takes adType parameter
  • isLoadedPrecache renamed to isPrecache that takes adType parameter(Currently supported only for interstitials)
  • setAutoCache now takes adType parameter
  • setOnLoadedTriggerBoth now takes adType parameter(Currently supported only for interstitials)
  • Updating MoPub library to 3.7.0
  • Fixing ad centering issue on new versions of Android WebView
  • isLoaded now returns false if autocache is disabled and ad is expired(OpenX ads only, they expire 4 minutes after cache)

1.11.1 (Apr 28, 2015, Internal)

  • Renaming interstitial callbacks from onAd... to onInterstitial...
  • Removing the need for android-support-v4.jar for SDK functionality. If your app doesn't need it function properly and you do not use SDKs that require it you can delete the android-support-v4.jar
  • Checking if loaded Applovin ad is video to prevent video display when interstitial is expected
  • Removing Facebook Audience Network library from SDK. Do not forget to remove Facebook entries from AndroidManifest.xml
  • Removing Mobilecore library from SDK. Do not forget to remove Mobilecore entries from AndroidManifest.xml
  • Fixing an issue where SDK will not work on Android 4.0.4 in Unity apps in some cases

1.11 (Apr 21, 2015, Internal)

  • Adding video support
  • Adding video callbacks
  • Adding Unity Ads support
  • Removing the need of applovin.sdk.key in AndroidManifest.xml
  • Changing debug file from "110" to "1100"
  • com.appodeal.ads.AdActivity renamed to com.appodeal.ads.InterstitialActivity
  • com.appodeal.ads.VideoActivity added to AndroidManifest.xml

1.10.10

  • Adding Appodeal.showBannerWithPriceFloor() method that displays banner only if it's ecpm is bigger or equal to price floor set in our dashboard
  • Fixing issue with SDK pausing when switching between activities
  • Bug fixes

1.10.9

  • Adding Facebook Audience Network support
  • Adding Mobilecore support
  • Adding Admob Adapter
  • Preventing Appodeal methods from being called in Unity Editor

1.10.8

  • MoPub click url fix

1.10.7

  • Removing Heyzap library from SDK. Do not forget to remove Heyzap entries from AndroidManifest.xml
  • Updating AmazonAds library to 5.5.102
  • Updating Chartboost library to 5.2.0
  • Updating MoPub library to 3.6.1
  • Bug fixes

1.10.6

  • Setting timeout for each network and precache load
  • Pausing SDK when app goes to background on Android 4.0+
  • Resuming SDK when app returns to foreground on Android 4.0+
  • Bug fixes

1.10.5

  • showBanner() now returns a boolean value indicating whether show call was passed to appropriate SDK
  • Retrying ad caching if network connection was lost
  • Bug fixes

1.10.4

  • Displaying toast message if android-support-v4.jar library not present
  • Fixing Heyzap integration issue
  • Adding Appodeal.isLoadedPrecache() method that returns whether precache or normal ad was loaded
  • Adding Appodeal.disableNetwork(String) method to disable network. Available parameters: "admob", "amazon_ads", "applovin", "chartboost", "heyzap", "mopub"
  • Fixes and performance optimizations

1.10.3

  • Adding MoPub adapter to SDK

1.10.2

  • Adding boolean parameter to onAdLoaded callback. If true precache was loaded, if false normal ad was loaded. By default onAdLoaded callback triggers only when normal ad was loaded.
  • Adding Appodeal.setOnLoadedTriggerBoth() method.
  • setOnLoadedTriggerBoth(false) - onAdLoaded will trigger only when normal ad was loaded.
  • setOnLoadedTriggerBoth(true) - onAdLoaded will trigger twice, both when precache and normal ad were loaded

1.10.1

  • Fixing onAdClosed not triggering bug
  • Preventing onAdFailedToLoad from triggering if precache was loaded
  • Small fixes

1.10

  • Adding Admob precache to make ads load faster
  • Updating Applovin library to 5.4.3
  • Updating Chartboost library to 5.1.2
  • Updating MoPub library to 3.5.0
  • Bug fixes and some architectural changes
  • Increasing support on devices without GPS. Add
<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />
  • to your AndroidManifest.xml if you don't require this hardware features to make app compatible with devices without GPS

1.9.2

  • Adding cacheBanner method to manually cache banner. You should disable automatic caching before SDK initialization using setAutoCache(false)
  • Adding setAutoCache method to enable or disable automatic caching. Should be used before SDK initialization.

1.9.1

  • Adding Unity callbacks
  • Updating MoPub library to 3.4.0
  • Bug fixes

1.9

  • Adding Smaato support
  • Adding Heyzap support