NinthDecimal Android Integration Guide


This guide will walk you through adding NinthDecimal Rewards to your Android application. Once you’re done, navigate over to the SDK Docs for more in-depth information on our SDK.

The NinthDecimal Android SDK requires you to have an Application.class, as well as a few other details, which we will help you create below.

Note: Due to GDPR regulations, NinthDecimal is now blocking all ad requests from the affected EEA regions.

Getting started

First you’ll need to sign up at, and grab your application key and secret.

Downloading the NinthDecimal SDK

The latest NinthDecimal SDK version 3.1.0 is available in JCenter. The older version is always downloadable from the downloads page. The download also contains a helpful sample project showing off many advanced features and the actual SDK.

Adding Yourself as a Test Device

There are two ways to set Test Mode using the NinthDecimal SDK.

1. Setting Test Mode at the build level

This Test Mode method requires NinthDecimal SDK 2.3.0 or higher. To set Test Mode at the build level requires including the following flag:

public abstract void setTestMode(java.lang.Boolean testMode)

The default value for this flag is NO.

2. Setting Test Mode at the device level

If using this method, we recommend adding a test device to your app before getting started with integrating NinthDecimal. However, you can add a test device in the NinthDecimal dashboard at any time.

To add a test device to your Android app, click the Test Devices button at the bottom of the desired application page on the NinthDecimal Dashboard. Define a unique name for the device and the device’s Google Advertising ID. This can be found in the device’s Google Settings > ads.

For NinthDecimal Android SDK 2.0.8 or earlier, substitute the device’s Android ID for the Google Advertising ID. Use ADID Sender if you need help locating a device’s Android ID.

android test device example

Note: The Android Emulator will always will be recognized as a test device.

Common Testing Questions

What if I’m not in the US? How do I see a NinthDecimal reward? When testing from outside the US it is recommended to use a US-based VPN connection when requesting rewards. Test rewards fill 100% of the time, whereas with live/production rewards it is expected that not every request will be filled with a reward. It is important that you add the correct device identifier inside the Test Devices section of the NinthDecimal dashboard.

A null poptart? No test reward? Some devices work but others don’t!

If you’re getting a null poptart, don’t worry. This means you have correctly saved a moment through the SDK, but we didn’t recognize your device as a test device. Try the following steps:

  • Ensure limited ad tracking is disabled in Google Settings.
  • Ensure you have copied and pasted the Google Advertising Identifier correctly.
  • Delete and re-add the correct device identifier. 2.0.9 requires Google Advertising ID, below requires Android ID.

Integrate NinthDecimal

The NinthDecimal SDK is available as an AAR via JCenter. In your project, open build.gradle (Project) and add the following repository to the buildscript{ repositories{} } section to download the SDK from the JCenter Repository:

buildscript {
    repositories {

Open build.gradle (Module:app) and add the following line to the compile statements to the dependencies{} section.

dependencies {
    compile 'me.kiip.sdk:kiip:3.1.0'

Build your project.

In the KiipSDK directory, you’ll find both a libs and res folder. You will need to drag each folder onto the Eclipse project so that you have both the NinthDecimal library and drawables.

Adding NinthDecimal Permissions

In your AndroidManifest.xml file, the following permissions will need to be requested in order to use the NinthDecimal SDK:

<!-- NinthDecimal -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- END -->

<!-- NinthDecimal Optional Permissions -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- END NinthDecimal Optional Permissions -->

Note: Only NinthDecimal SDK 2.3.3 or below requires you to add the following meta-data and provider xml tags.

<!-- Add a meta-data & provider element to the application element -->
<application android:label="@string/app_name" ...>
    <meta-data android:name="me.kiip.sdk.AppKey" android:value="@string/kiip_app_key"/>

    <provider android:name="me.kiip.sdk.KiipSDKProvider"
          android:exported="true" />
<!-- END Add a meta-data & provider element to the application element -->

Application Lifecycle

The NinthDecimal SDK intelligently manages its presence inside your application’s lifecycle, so you don’t have to. It does, however, require you to let it know whenever you start or stop an activity in your application and when your application is first created. A helper class exists to take care of all that for you.

Creating a BaseActivity Class

The best way to let the NinthDecimal SDK know whenever a new activity in your application is started or stopped is to create an alternative Activity that all the activies extend. A sample is below:

public class BaseActivity extends FragmentActivity {
    private final static String KIIP_TAG = "kiip_fragment_tag";
    private KiipFragmentCompat mKiipFragment;

    protected void onCreate(Bundle savedInstanceState) {

        // Create or re-use KiipFragment.
        if (savedInstanceState != null) {
            mKiipFragment = (KiipFragmentCompat) getSupportFragmentManager().findFragmentByTag(KIIP_TAG);
        } else {
            mKiipFragment = new KiipFragmentCompat();
            getSupportFragmentManager().beginTransaction().add(mKiipFragment, KIIP_TAG).commit();

    protected void onStart() {
        Kiip.getInstance().startSession(new Kiip.Callback() {
            public void onFailed(Kiip kiip, Exception exception) {
                // handle failure

            public void onFinished(Kiip kiip, Poptart poptart) {

    protected void onStop() {
        Kiip.getInstance().endSession(new Kiip.Callback() {
            public void onFailed(Kiip kiip, Exception exception) {
                // handle failure

            public void onFinished(Kiip kiip, Poptart poptart) {

    public void onPoptart(Poptart poptart) {

Note: You can also modify an existing BaseActivity to include the NinthDecimal code.

Extending your New BaseActivity Class

After creating your new BaseActivity, all that’s left to do is edit all your other activities to extend the new class rather than the Android default.

public class MainActivity extends Activity
public class MainActivity extends BaseActivity

Application Class

If you have an Application class already, then you can skip ahead to the onCreate() portion below

The NinthDecimal SDK requires you to have an application class and initialize NinthDecimal in your application’s onCreate() call.

Creating an Application Class

Create a new class named and have it extend Application. Something like below:

public class App extends Application {
	public void onCreate() {

Now we need to add the new Application class to the AndroidManifest.xml. Modify it to add the android:name parameter in the <application> section, where the name is the name of your Application class (in this case it’s App):

    android:name=".App" >

Initializing NinthDecimal in your Application’s onCreate()

Now that we have an application class, we’ll need to implement the onCreate() method and add in the NinthDecimal initialization. Modify your onCreate() to look like this:

public void onCreate() {
    Kiip.init(this, KIIP_APP_KEY, KIIP_APP_SECRET);

Call a NinthDecimal Moment

Now that your application lifecycle is all setup, it only takes one call to send a reward to a device.

Call a NinthDecimal moment by using the following code:

Kiip.getInstance().saveMoment(my_moment_id, new Kiip.Callback() {

    public void onFinished(Kiip kiip, Poptart poptart) {
        if (poptart == null) {
            Log.d(KIIP_TAG, "Successful moment but no reward to give.");
        else {

    public void onFailed(Kiip kiip, Exception exception) {
        // handle failure

That’s all it takes to turn any event into a NinthDecimal moment. If you’re using the Android Emulator or a test device to call a moment, a reward should show when successfully called.

The onPoptart() call from your BaseActivity will take care of displaying fullscreen interstitial (depending on your settings).

Moment Names

Carefully consider your moment name. When you provide a title such as ‘finishing level one.’ it will be displayed to the end user when a reward is earned. The string for rewards is typically, “Congratulations! Here’s a reward for finishing level one.” This mean using an active verb such as ‘finishing’ and not ‘finished’ would be a more appropriate for a moment name.

You can always edit your moment names later in the dashboard.

Reward Virtual Currency

To enable virtual currency, create a currency listener and let NinthDecimal know you can deliver Virtual Rewards. This listener will be called whenever a Virtual Reward is served and the user redeems it.

Kiip.OnContentListener onContentListener = new Kiip.OnContentListener() {
    public void onContent(String content, int quantity, String transactionId, String signature) {
        // Handle receiving virtual reward. Increment users wallet with quantity etc.


Make sure virtual currency is enabled for your app. This setting can be found on the app’s profile page in the NinthDecimal dashboard.

This listener will be called by the NinthDecimal SDK after a user redeems a reward that carries a virtual currency value. We will pass a quantity of currency into the method under the quantity parameter and the name of the currency, if there are multiple, under the content parameter. You can then handle depositing the value via your in-game currency management.

If a user chooses not to redeem currency, then the value passed down will be zero.

If a virtual currency postback endpoint is provided to kiip, you can confirm issuance of virtual currency and gain access to additional virtual currency reward opportunities.

Rewarded Video

Access more inventory, increase engagement and drive more revenue with Rewarded Video. To utilize Rewarded Video, designate and individual moments placement in the NinthDecimal dashboard.

NinthDecimal Rewarded Video Moment

Sample Application

We’ve provided a couple of sample applications for you to browse. Check out our public Github repo in case you’d like to try custom notifications, or just need to see some code samples.

Trouble with test rewards?

If your test device is not located in the US and you’re having trouble retrieving a test reward, please use a VPN with set to a US location.

VPN Assistance

We’re aware of occurances where developers using a US-based VPN experience IP leakage which prevents them from seeing test rewards. We suggest using a service like or a similar service to detect potential IP leaks to ensure you can test NinthDecimal successfully.

Need Help?

We’re happy to answer any questions about integrating NinthDecimal. Please email us.