Android - Appnext

ANDROID NATIVE SDK
(14.17.07.ANDROID)
About this Document
appnext mobile solution allows you to display ads of other apps and games to your users, earn money,
and provide your users a game discovery service. To monetize your users with appnext, the product
must be integrated into your game or app. This document will guide you through the integration process.
Target Audience
appnext's clients who propose to display interstitial ads, in their mobile app/game.
Register for an Appnext Account
You must first create an account with appnext to be able to use the API features. If you do not have an
appnext account, copy the following URL to the browser: https://www.appnext.com and sign up.
Unique ID
A unique ID, called “Placement ID”, is required for all inbound requests. Placement ID is a 32-character
string generated by appnext for every registered app/website.
Get Unique ID
To get started - add a new Web App in appnext’s self-service, then copy the Placmenet ID which can be
found in your account at: MyApps -> Settings&Placements -> Placement ID (make sure to copy the
Placement ID for both Android and iOS apps).
Updated: 17-Jul-2014
Page | 1
ANDROID NATIVE SDK
(14.17.07.ANDROID)
Integrating appnext SDK to your Android app / game:
Note: If you haven’t done so already, download the appnext SDK by clicking here.
The process of integrating appnext is fairly straightforward and does not require heavy programming.
The process of using appnext in your applications is described below in outlined steps:




Add the AppNextSDK.jar to your project
Edit your manifest
Initialize SDK with your app ID
Show Ads
The actual code-level integration is described in the sections below. Should you have any problems
integrating the product, log a ticket with us by emailing [email protected].
Step 1: Add the appnext SDK to Your Project
Add the AppNextSDK.jar to your "libs" folder in your project.
Step 2: Edit the AndroidManifest.xml File
To properly use appnext, you need to make sure you allow the following permissions in your manifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
And add this service declaration in your application tag
<service android:name="com.appnext.appnextsdk.DownloadService"/>
Permissions explanation:
android.permission.INTERNET
Mandatory
Used to get the ads information.
android.permission.GET_ACCOUNTS
Optional (but highly recommended)
Used to get the user's email. Lets the user send the app offer to his email.
Updated: 17-Jul-2014
Page | 2
ANDROID NATIVE SDK
(14.17.07.ANDROID)
Step 3: Initialize appnext
Create class member:
Appnext appnext;
We recommend showing the popup when app is starting. To do so, add the following code to the
onCreate function in your Activity:
appnext = new Appnext(this);
appnext.setAppID("<PlacementID>"); // Set your AppID
appnext.showBubble(); // show the interstitial
You can override the back button to close the popup by adding the following to your code:
appnext.hideBubble();
You can alternatively show the interstitial using a triggering event:
appnext.showBubble();
Step 4: Callbacks (optional)
In case you want to get notified about appnext's events we offer you a few callbacks. You can decide
which callback to implement.
a) Ad load callback
appnext.setAdLoadInterface(new OnAdLoadInterface() {
@Override
public void adLoaded() {
Log.v("appnext", "on ad load");
}
});
b) Ad failed to load callback
appnext.setNoAdsInterface(new NoAdsInterface() {
@Override
public void noAds() {
Log.v("appnext", "no ads");
}
});
Updated: 17-Jul-2014
Page | 3
ANDROID NATIVE SDK
(14.17.07.ANDROID)
c) Popup opened callback
appnext.setPopupOpenedInterface(new PopupOpenedInterface() {
@Override
public void popupOpened()
Log.v("appnext", "popup opened");
}
});
d) Click callback
appnext.setPopupClickedCallback(new PopupClickedInterface() {
@Override
public void popupClicked() {
Log.v("appnext", "popup clicked");
}
});
e) Popup closed callback
appnext.setPopupClosedCallback(new PopupClosedInterface() {
@Override
public void popupClosed() {
Log.v("appnext", "popup closed");
}
});
Step 5: Caching (optional)
To cache an ad use the following line
appnext.cacheAd();
Updated: 17-Jul-2014
Page | 4
ANDROID NATIVE SDK
(14.17.07.ANDROID)
To show ClickTag Ads using a “more apps” button:
Select one of the following:
appnext.addMoreAppsLeft("<PlacementID>");
or
appnext.addMoreAppsRight("<PlacementID>");
Note: We suggest using a different Placement ID in the “more apps” button.
you can generate new Placements at “My Apps” page in appnext’s website:
https://selfservice.appnext.com/Apps/Manage.aspx
To get the library version:
Appnext.getVersion();
Integration Support
Should you have any problems integrating the product, log a ticket with us by emailing
[email protected].
Updated: 17-Jul-2014
Page | 5