Android SDK 11.0 Documentation

From docs.airnowmedia.com
Jump to: navigation, search

Overview

The Airnowmedia SDK is the most powerful app monetization solution in the industry, providing developers with stunning performance and weekly payouts. Airnowmedia developers consistently earn many times more revenue than with any other ad network because our advanced new ad units outperform everything else available in the industry. This document covers installation instructions, available ad units and their features, optimization, and best practices. It is written for developers with the assumption they are familiar with Android development.

Ad Units

There are 3 types of ad units available in this SDK.

In-App and Inline Banner Ads

In-App and Inline Banner Ads are a staple of the mobile advertising world. Combined with the rest of Airnowmedia’s industry leading ad types, In-App Banner Ads enable Android developers to monetize their users at every point in their mobile experience and maximize their revenue.

Interstitial Ads

Interstitial Ads are full-screen ads that cover the interface of their main application. They are usually displayed at points of natural transition in the flow of the application, for example, between levels in a game.

Airnowmonetization SDK supports static and animated Interstitial ads types, as well as video VAST ads.

Installation Instructions

The Airnowmedia Android SDK contains the code necessary to install Airnowmedia ads in your application.

Airnowmedia Android SDK Requirements:

  1. Android Studio
  2. JDK 1.8
  3. Android 4.1 (API Level: 16) or later
  4. Google Play Services Ads library installation guide

Step 1 – Adding Airnowmedia SDK

  1. Copy the library AnSdk.jar to your project in the folder libs.
  2. Add dependencies to your project: implementation files('libs/AnSdk.jar')
  3. Add the following objects to the manifest:
  4. mandatory objects:

    <uses-permission android:name=“android.permission.INTERNET” />

    <uses-permission android:name=“android.permission.ACCESS\_NETWORK\_STATE” />

    <activity* *android:name=“com.ap.AnActivity”* *android:configChanges=“orientation|keyboardHidden|screenSize”* *android:theme=“@android:style/Theme.Translucent.NoTitleBar” />

    recommended objects:

    <uses-permission android:name=“android.permission.ACCESS\_COARSE\_LOCATION” />

    <uses-permission android:name=“android.permission.ACCESS\_FINE\_LOCATION” />

  5. To use the Google Ads opt-out setting, add the “com.google.android.gms:play-services-ads” Google Mobile Ads library to your project. You can find the instructions at developers.google.com
  6. Mandatory rules for ProGuard:

    -keep class com.ap.** {*;}

  7. Once completed, the SDK is ready to use.

Step 2 – Configure your project to receive ads.

  1. Call init method before showing ads:
  2. AnSdk.init(context, “yourApiKey”, “yourAppId”);

    YourApiKey and yourAppId were given to you when registering your Android application on Airnowmedia. It's a numeric code that can be found by locating your app in the apps dashboard.

    Page-2-Image-1.jpg

    For testing, you can use next ones:

    AnSdk.init(context, "1512296951303967283", "384198");

Step 3 – Code Integration.

    Airnowmonetization SDK currently supports 3 types of advertising: Inline and In-App banners, Interstitial Ads.

    Inline banner

    To display Inline Banner, use the following piece of code in the xml layout:

    <com.ap.AnBanner* *android:id="@+id/container"* *android:layout\_width="wrap\_content"* *android:layout\_height="wrap\_content"/>

    After that, get the view object from the layout and call the show method in this view:

    AnBanner inlineBanner = ((AnBanner) findViewById(R.id.container));

    inlineBanner.setEventsListener(new AnEventsListener() {

    @Override

    public void onLoaded(AnPreparedAd ad) {

    ad.show();

    }

    @Override

    public void onFailed(String reason) {}

    @Override

    public void onClicked() {}

    @Override

    public void onOpened() {}

    @Override

    public void onClosed() {}

    @Override

    public void onLeaveApplication() {}

    });

    //If you need custom banner size, you can use next method

    //inlineBanner.setSize(320, 50);

    inlineBanner.load();

    We recommend using the following banner sizes:

    320x50 (Banner)

    468x60 (Full Banner)

    728x90 (Leaderboard)

    300x250 (Medium Rectangle)

    The banner will reload automatically until it is destroyed. It will be destroyed automatically with your Activity/Fragment. Also you can destroy it any time by calling:

    inlineBanner.destroy();

    In-app banner

    To display In-App Banner, use this code:

    AnAppBanner inappBanner = new AnAppBanner(this, 0);

    inappBanner.setEventsListener(new AnEventsListener() {

    @Override

    public void onLoaded(AnPreparedAd ad) {

    ad.show();

    }

    @Override

    public void onFailed(String reason) {}

    @Override

    public void onClicked() {}

    @Override

    public void onOpened() {}

    @Override

    public void onClosed() {}

    @Override

    public void onLeaveApplication() {}

    });

    //If you need custom banner size, you can use next method

    //inappBanner.setSize(320, 50);

    inappBanner.load();

    We recommend using the following banner sizes:

    320x50 (Banner)

    468x60 (Full Banner)

    728x90 (Leaderboard)

    300x250 (Medium Rectangle)

    The banner will reload automatically until it is destroyed. It will be destroyed automatically with your Activity/Fragment. Also you can destroy it any time by calling:

    inappBanner.destroy();

    Interstitial Ads

    To display an Interstitial, use this code:

    AnInterstitial interstitial = new AnInterstitial(this);

    interstitial.setEventsListener(new AnEventsListener() {

    @Override

    public void onLoaded(AnPreparedAd ad) {

    ad.show();

    }

    @Override

    public void onFailed(String reason) {}

    @Override

    public void onClicked() {}

    @Override

    public void onOpened() {}

    @Override

    public void onClosed() {}

    @Override

    public void onLeaveApplication() {}

    });

    interstitial.load();

    The interstitial ad does not automatically reload. Call interstitial.load () every time you want to reload your ad.

Airnowmedia SDK Test Mode

You can set test mode to customize ads in your application. In test mode, you will only receive test ads.

To enable or disable test mode, use the method:

AnSdk.setTestMode(mode); mode = true/false (enable/disable)

Airnowmedia Opt-Out Ads

Your Android mobile device may provide a "Limit Ad Tracking" or "Opt out of interest-based advertising" setting. If you opt out of using this option on a device, Airnowmedia will not use the information collected from that device to identify your interests or to display ads on that device that target your intended interests.

For Android devices with OS 2.2 and up and Google Play Services version 4.0 and up: Open your Google Settings app > Ads > Enable “Opt out of interest-based advertising”

The Airnowmedia SDK also contains built-in functionality to manage personalized ad opt-out. Application developers can use them to provide this functionality at the application level.

To manage personalized ad opt-out, use the methods:

AnSdk.setOptOut(context, mode); mode = true/false (enable/disable)

AnSdk.isOptOutEnabled(context);

If you opt out, you will still see the same amount of Airnowmedia ads on your mobile device; however, these ads may be less relevant because they will not be relevant to your interests.

Important Instructions

  • For the best experience, please use the latest Android SDK.

Sample Application Code and Support

You can download the demo project "Android SDK Integration DemoApp" using the following link. This is code demonstration on how to integrate Airnowmedia Android SDK in your app.

Demo app will work without any modifications on simulator.

Note: For the privacy of your users, Airnowmedia never stores personally identifiable information.

Personal tools
Namespaces

Variants
Actions
Toolbox