Standard SDK 1.0
Overview
Airpush's
Standard SDK allows developers to earn industry-leading advertising CPM revenue with the world's highest global fill rates.
- Advanced in-app banner ad units with 360 Banner, including new Abstract Banners.
- Interstitial ad type mediation with SmartWall.
- Full Google Play compliance.
- Free Weekly Payments.
Package Name
Your package Name :
com.urah.olmk210167
Ad Units
360 Banner includes Abstract,
Video, and IAB Standard
Banner formats.
SMARTWALL
SmartWall includes Video,
Rich Media, AppWall, Dialog,
and Overlay formats.
To enable and optimize each of these ad units, select the
corresponding check box next to each ad unit in 'Step 2' of adding your
app. Free weekly payments are available for each.
360 Banner
360 Banner reinvents the traditional in-app banner placement, automatically mediating between
Traditional Banners, HTML5 Video Banners and revolutionary
Abstract Banners. This results in a greater user experience and a huge increase in developer earnings.
- Higher earnings than any other banner placement.
- One integration powers multiple ad types.
- Uses traditional IAB banner size placements.
- Ensures a quality user experience.
-
- NEW - Airpush's Revolutionary Abstract Banners included in 360 Banner
-
- The banner is back! Drive 2-5x more earnings than
traditional banners with Airpush’s new Abstract Banners. These
innovative and deeply engaging ad formats seamlessly blend full motion
transparent overlays with app content and result in dramatically higher
earnings than any other banner format.
-
- 2x-5x standard banner earnings
- Gorgeous, closable, animated ads
- Deep publisher controls
- 100% high quality ads
- Free weekly payments
SmartWall
SmartWall automatically mediates between
Rich Media, Video, AppWall, Dialog Ads, Advanced Overlays, and more based on yield and network connection type!
- Higher earnings than any other interstitial.
- One integration powers multiple ad types.
- The only interstitial you’ll ever need.
- Ensures a quality user experience.
Installation Instructions
Standard SDK 1.0 contains the code necessary to install Airpush ads
in your application. This wiki will guide you through a simple XML
implementation.
Airpush Standard SDK Requirements:
- JDK 1.6 or later
- Android 2.1 or later
- Google Play Services SDK
Step 1 - Adding the JAR
For Eclipse Projects:
Copy the
com-urah-olmk210167.jar to the "libs" folder of your project and move on to step 2.
To verify whether it's added to your project, expand "Android Dependencies:"
Step 2 - Google Play Services SDK
Please follow the
https://developer.android.com/google/play-services/setup.html#Install steps for adding Google Play Services SDK in project.
Step 3 - Editing Your Manifest File
First you'll need to note your Airpush
<App Id> and
<API Key>, which was given to you when registering
your Android application on
www.airpush.com. It's a numeric code that can be found by locating your app in the apps dashboard:
Just before the closing </application> tag of your AndroidManifest.xml file, you'll need to add the following:
1. Copy and paste the following XML
Placed just before the closing
</application> tag:
Required declaration for all ads
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<meta-data android:name="com.urah.olmk210167.APPID" android:value="<Your appId>" />
<meta-data android:name="com.urah.olmk210167.APIKEY" android:value="android*<Your ApiKey>"/>
<activity android:exported="false" android:name="com.urah.olmk210167.MainActivity"
android:configChanges="orientation|screenSize"
android:theme="@android:style/Theme.Translucent" />
<activity android:name="com.urah.olmk210167.BrowserActivity"
android:configChanges="orientation|screenSize" />
<activity android:name="com.urah.olmk210167.VDActivity"
android:configChanges="orientation|screenSize" android:screenOrientation="landscape"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
2. Add The Following Permissions
Required permissions for all ads
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
Additional required permission for Smartwall Ad.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Optional permissions:
(
We strongly recommend you to add the optional permissions to enhance your Application earnings)
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Optional permission:
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Step 4 - Editing Your Main File
Inside "Activity," please add:
Prm ma=new Prm(this, null, false);
Example:
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;
import com.urah.olmk210167.AdListener; //Add import statements
import com.urah.olmk210167.Prm;
public class MainActivity extends Activity{
private Prm prm; //Declare here
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.ad);
if(prm==null)
prm=new Prm(this, adCallbackListener, false);
}
- Parameters
- Activity activity
- AdListener adCallbackListener
- boolean enablecaching This parameter will enable
caching for SmartWall Ads. When you will use a SmartWall ad call it
cached the ad locally. To show the ad you need to call
prm.runCachedAd(this, adType);.
Caching
This is a new feature which we have added it in this version for
better user experience. You can cache an ad before displaying it to
user. To enable cache pass the third parameter as
true as mentioned above.
Example
//SDK Instance.
static Prm air = null;
private AdType adtype;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
/**
* Initializing Standard SDK
* @Param Activity
* @Param AdListener
* @Param boolean. Ex:For caching enable set as "true".
*/
air = new Prm(this, this, true);
//Caching Smartwall Ad.
air.runSmartWallAd();
}
@Override
public void onBackPressed() {
//Displaying Cached SmartWall Ad
try {
air.runCachedAd(this, AdType.smartwall);
} catch (Exception e)
{
super.onBackPressed();
}
}
Note: You can use caching for Smartwall ad formats. Please use the above mentioned steps for caching.
Using SmartWall in your application:
Airpush’s SmartWall is comprised of the following four sub Ad Formats:
- Dialog Overlay Ad
- AppWall Ad
- Rich Media Interstitial Ad
- Video Ad
Note: Landing page ad format is not available in this version.
Airpush’s ad server determines and displays the best
sub-ad-format to maximize your revenue from Interstitial Ad Placements
in your application. You just have to call the “prm.runSmartWallAd()”
method wherever you want to show Airpush’s Smartwall. For example: in
the case of a gaming app, you can call "prm.runSmartWallAd()" between
different levels and show a SmartWall app after a user clears each
level. Airpush also offer flexibility for developers to choose a
specific sub-ad-format from the above options to display by using the
following methods within your code:
- To start Overlay Dialog Ad: prm.runOverlayAd();
- To start AppWall Ad: prm.runAppWall();
- To start Rich Media Interstitial Ad: prm.runRichMediaInterstitialAd();
- To start Video Ad: prm.runVideoAd();
Note: Although developers can choose to display a specific
sub-ad-format, we highly recommend using the “prm.startSmartWallAd()”
method which lets the Airpush ad server decide the best sub-format in
order to maximize your earnings. We would also recommend showing
Smartwall on App Launch and App Exit to maximize monetization. Here's
sample code for showing Airpush’s Smartwall on app exit:
If you want to show a SmartWall ad where the sub-format will be determined by SDK, please use the code below:
Example: Ad caching enabled
@Override
public void onBackPressed() {
try{
prm.runCachedAd(this, AdType.smartwall); //Will show the ad is it's available in cache.
}catch (Exception e) {
// close the activity if ad is not available.
super.onBackPressed();
}
}
If your application supports Android version 2.0 or below, please initialize the SDK as shown below:
if(android.os.Build.VERSION.SDK_INT >=7){
Prm prm=new Prm(this, null, true);
prm.runSmartWallAd(); //start smartwall ad.
}
Using 360 Ad in your application:
/**
* @activity : Activity instance.
* @PLACEMENT_ID : Number between 0 to 100.
* @testmode : "false" for livemode & "true" for testmode.
* @listener : Adlistener.MraidAdListener callback listener for 360 Ad.
*/
prm.run360Ad(Activity activity, int PLACEMENT_ID, boolean testmode, Adlistener.BannerAdListener listener);
Example :
private Prm prm; //Declare Airpush here
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.ad);
// SDK initialization.
if(prm==null)
prm=new Prm(this, adCallbackListener, true);
// 360 Ad.
prm.run360Ad(this, 0, false, null);
}
5. AdCallbackListener:
In this SDK version we've added callback listeners for all ads, which can be called using the code below:
private Prm prm; //Declare Airpush here
@Override
protected void onCreate(Premium savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.ad);
if(prm==null)
prm=new Prm(this, adCallbackListener, true);
}
AdListener adCallbackListener=new AdListener() {
@Override
public void onSDKIntegrationError(String message) {
//Here you will receive message from SDK if it detects any integration issue.
}
public void onSmartWallAdShowing() {
// This will be called by SDK when it’s showing any of the SmartWall ad.
}
@Override
public void onSmartWallAdClosed() {
// This will be called by SDK when the SmartWall ad is closed.
}
@Override
public void onAdError(String message) {
//This will get called if any error occurred during ad serving.
}
@Override
public void onAdCached(AdType arg0) {
//This will get called when an ad is cached.
}
@Override
public void noAdAvailableListener() {
//this will get called when ad is not available
}
};
Step 6 - Banner Ads
Banner ads includes Medium Rectangle banner and
IAB MRAID 2.0 compliant Rich Media banner ads. To show these ads in your app, you'll need to add the following entry into your
layout.xml file (app's layout file).
<com.urah.olmk210167.AdView
xmlns:ap="http://schemas.android.com/apk/res-auto"
android:id="@+id/myAdView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ap:animation="fade"
ap:banner_type="inappad"
ap:placementType="interstitial"
ap:test_mode="false"
ap:canShowMR="false"
/>
banner_type: [String] There are three types of banner ads. You can use only one at a time, with the
"inappad" banner type being the default.
- inappad: (Recommended) It shows rich media ads.
It's highly recommended. Ads are always decided by Airpush ad server at
the time of request. It will keep you fill rate high. If you want to
show medium_rectangle banner also please use
canShowMR="true".
- canShowMR: [Boolean] This will be used when
banner_type="inappad". If it's true then SDK can show medium rectangle banner.
- medium_rectangle: Shows an image banner of 300x250 size.
- rich_media: Shows IAB MRAID 2.0 compliant rich media banner. Also you need to provide
“placementType[String]" for rich media banners it's required. There are two kinds of placement types:
- interstitial: This shows an interstitial ad which is built using HTML5/JavaScript.
- inline: This shows a banner with HTML5/JavaScript. Size[mobile: 468x60, tablet:728x90]
animation: [String] There are three kinds of animations which
can be used to show these ads; [fade, top_down, left_to_right]. Fade is
the default. This applies to banner ads only.
test_mode: [Boolean] This takes a boolean value. Please set it to
false before uploading it in Google play.
You also need to place the
mraid_attrs.xml file into your app's
res > values folder. This file is included within the SDK download.
Use banner ads using Java code
/* AdView Class is same as View Class. You can use the Adview object as View object. */
AdView adView=new AdView(this, AdView.BANNER_TYPE_IN_APP_AD, AdView.PLACEMENT_TYPE_INTERSTITIAL, false, false,
AdView.ANIMATION_TYPE_LEFT_TO_RIGHT);
adView.setAdListener(this);
Parameters:
- Activity reference.
- banner_type String
- placmentType String
- canShowMR boolean
- isTestMode boolean
- animation String
Please check "Premium Demo" project for more details
Use Banner Ad Callback Listener
You can use the code below in your Activity file:
@Override
protected void onCreate(Premium savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.ad);
AdView adView=(AdView)findViewById(R.id.myAdView);
adView.setAdListener(adlistener);
}
AdListener.BannerAdListener adlistener = new AdListener.BannerAdListener() {
@Override
public void onAdClickListener()
{
//This will get called when ad is clicked.
}
@Override
public void onAdLoadedListener()
{
//This will get called when an ad has loaded.
}
@Override
public void onAdLoadingListener()
{
//This will get called when a rich media ad is loading.
}
@Override
public void onAdExpandedListner()
{
//This will get called when an ad is showing on a user's screen. This may cover the whole UI.
}
@Override
public void onCloseListener()
{
//This will get called when an ad is closing/resizing from an expanded state.
}
@Override
public void onErrorListener(String message)
{
//This will get called when any error has occurred. This will also get called if the SDK notices any integration mistakes.
}
@Override
public void noAdAvailableListener() {
//this will get called when ad is not available
}
};
Using Proguard
Keep options required for Standard SDK 1.0
# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keepattributes *Annotation*
-injars bin/classes
-injars libs
-outjars bin/classes-processed.jar
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.preference.Preference
-keep class com.urah.olmk210167.** {*;}
-dontwarn com.urah.olmk210167.**
-keepclassmembers class *
{
@android.webkit.JavascriptInterface <methods>;
}
-keepclasseswithmembernames class *
{
native <methods>;
}
-keepclasseswithmembers class *
{
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class *
{
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers enum *
{
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable
{
public static final android.os.Parcelable$Creator *;
}
-keepclasseswithmembers class **.R$**
{
public static <fields>;
}
-keep 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);
void set*(***);
*** get*();
}
-keepclassmembers class *
{
static final % *;
static final java.lang.String *;
}
#add the following for Google play services.
-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 @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}
-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}
-dontwarn com.google.android.gms.**
#Google play services declarations ends
-keepattributes SetJavaScriptEnabled
-keepattributes JavascriptInterface
-keepattributes InlinedApi
Important Instructions
- For the best experience, please use the latest Android API as the build target.
- If you are upgrading/updating the SDK, please don't forget to clean & build the project after completing all steps successfully.
- Please enable the Smartwall ad type for your application under
your account within the Airpush Portal to utilize our Interstitial Ads.
Note: For the privacy of your users, Airpush never stores
personally identifiable information. Our SDK encrypts all IMEI numbers
using md5 hashing.
Official Airpush Plugins for Game Engines
Package downloads and documentation on all available plugins are available
here.
Sample Application Code and Support:
You can download the demo project "Standard demo" using the following link
http://manage.airpush.com/sdk/StandardDemo.zip.
This is code demonstration on 'How to integrate Airpush Standard SDK'
in your app.If you face any issues integrating SDK with your app please
feel free to drop an email to
publishersupport@airpush.comand our support team will get them resolved asap.
Note: For the privacy of your users, Airpush never stores
personally identifiable information. Our SDK encrypts all IMEI numbers
using md5 hashing.