2. Airpush Android SDK Installation Instructions
Airpush Android SDK contains the code necessary to install Airpush ads in your application. This PDF will guide
you through a simple XML implementation.
NOTE: you will need to replace all instances of <appid>, <package name> and <apikey> with your actual
application id, package name and api key which is obtainable from Airpush portal.
Step 1 – Adding the JAR
Copy the Airpush JAR file (AirpushSDK.jar) in your project's root directory.
For Eclipse projects:
• Right-click on your project from the Package Explorer tab and select “Properties”
• Select “Java Build Path” from the left panel
• Select “Libraries” tab from the main window
• Click on “Add JARs...”
• Select the JAR that's been copied to the project's root directory
• Click “OK” to add the SDK to your Android project
3. Step 2 – Editing Your Manifest File
First you will need to note your Airpush <appid> It was given to you when registering your Android application
on www.airpush.com (in Step 3). It is a numeric code and can be found by locating your app in the apps
dashboard.
Just before the closing </application> tag of your AndroidManifest.xml file, you will need to add three things:
1: Copy and paste the following XML just before the closing </application> tag:
<!-- Airpush Code Start-->
<activity android:name="com.airpush.android.PushAds"
android:configChanges="orientation|keyboardHidden"/>
<receiver android:name="com.airpush.android.UserDetailsReceiver"/>
<receiver android:name="com.airpush.android.MessageReceiver" />
<receiver android:name="com.airpush.android.DeliveryReceiver" />
<receiver android:name="<Package Name>.BootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
<service android:name="com.airpush.android.PushService">
<intent-filter>
<action android:name="com.airpush.android.PushServiceStart<Your
appId>"/>
</intent-filter>
</service>
<!-- Airpush Code End-->
* Please replace <Package Name> with your “package name” where boot reciever class has been added
(given in Step-4)
4. 2: Add Following Permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.VIBRATE"/>(Optional But
Highly recommended to enhance your revenue stream)
<uses-permission
android:name="android.permission.ACCESS_COARSE_LOCATION"/>(Optional But Highly
recommended to enhance your revenue stream)
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>(Optional
But Highly recommended to enhance your revenue stream)
5. Step 3 – Editing your main file.
Inside onCreate() method, please add :
new Airpush(getApplicationContext(), "<appid>","<apikey>");
Note: If your application supports android version 1.5 or below, please initialize the sdk as given below:
if(Integer.parseInt(VERSION.SDK) > 3){
new Airpush(getApplicationContext(),"<appid>","<apikey>");
}
You can either generate an <apikey> from permission API page or use “airpush” as API key.
6. Step 4– Setting Boot Receiver
If you don't have any boot receiver class in your application, Create one with name bootreceiver.java and add
the code given below or you can also use the example class file given along with SDK
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.airpush.android.Airpush;
public class BootReceiver extends BroadcastReceiver {
public void onReceive(Context arg0, Intent arg1) {
if(Integer.parseInt(VERSION.SDK) > 3){
new Airpush(arg0,"<appid>","<apikey>");
}
}
}
Or if you already have any boot receiver in your application add below code in your boot receiver.
new Airpush(context,"<appid>","<apikey>");
7. Step 5 – Setting Test Mode
While integrating Airpush SDK into your application it is recommended that you use test mode. This will help you
verify that your application is working fine with integrated SDK and test ads are returned every few minutes on
an emulator or real device before publishing your app to Android Market. To enable test mode, please include
the Boolean parameter while initializing Airpush as illustrated in the code below:
new Airpush(getApplicationContext(), <appid>, <apikey> , true);
Once you have verified SDK installation, you can turn test mode off by removing the Boolean parameter.
You can either generate an <apikey> from permission API page or use “airpush” as API key.
Sample Application Code and Support:
Included with this SDK is an Airtest Example Project (Airtest.rar) and in case of any issues integrating SDK,
please feel free to contact publishersupport@airpush.com
* Please note, for the privacy of your users Airpush never stores personally identifiable information. Our
SDK encrypts all IMEI numbers using md5 hashing.