Getting Started with Android SDK


Minimum version is Android 4.0 (Ice Cream Sandwich). Full feature support only available for 4.3+ (Jelly Bean MR2).

Installing the SDK


To install the Neumob SDK through Maven, add the following to your pom.xml between the <dependencies>…</dependencies> tags:



To install the Neumob SDK through Gradle, add the following compile line to your dependencies in your application build.gradle file (under project_name/app directory).

dependencies {
    compile 'com.neumob:neumob-android:3.7.2'

Manual installation

1. Download the Neumob JAR file on the portal page. You can find under a download link under your App settings.

  1. Copy the Neumob JAR file to your libs folder

3a. (Eclipse only) Right click your project, click Properties and select Java Build Path, click Add External Jar, and then add the Neumob JAR file. 3b. (Android Studio) Right click the jar file and click Add as library.

4. (Eclipse only) You must make the following changes in the Eclipse IDE in order to perform builds directly from Eclipse. On the Eclipse menu bar, go to ADT -> Preferences -> Android -> Build, uncheck the option Force error when external jars contain native libraries.

Setting up the Manifest

For full functionality with Neumob, you will need to add the following permissions to your AndroidManifest.xml file.

  • INTERNET - Required
  • ACCESS_NETWORK_STATE - Required, allows Neumob to determine optimal mobile configurations
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Initializing Neumob

Initialization is the process of modifying your application in order to communicate with Neumob. Initialize Neumob only once on the main thread at the beginning of your onCreate activity.


If you are adding the Neumob import manually, use

import com.neumob.api.Neumob;

Neumob is now integrated with your Android application! In order to turn ON Neumob for your app version you’ll go to the portal’s app details page where you received your client key. The State for the app version will be OFF and this can be changed by clicking the settings button under Action, toggling the switch in the upper right corner of the following screen, and then the Apply button at the bottom.

If you are using a 3rd party library like OkHttp for networking, please check out Compatibility section at the bottom of this page to see libraries. If you are using OkHttp, Retrofit2, or Picasso, you'll need to follow the integration setup documents below:


Neumob takes about 2 days to learn, customize, and then accelerate your network calls.

Verifying Integration

To check that Neumob is initialized and whether an app session is being accelerated, you can add a Runnable parameter that will execute after initialize is completed. Because init can be asynchronous, checking isAccelerated and related API outside of the Runnable may return inconsistent values.

isInitialized returns a boolean indicating Neumob is enabled and ready to accelerate your network requests.

isAccelerated returns a boolean indicating whether Neumob is currently accelerating your requests. You may configure whether or not Neumob is accelerated by adjusting the % accelerated slider through the portal (click the settings button for the app version on your app details page). If you plan to A / B test accelerated vs unaccelerated Neumob users, we recommend using the isAccelerated API in the Runnable. Please note that isAccelerated is sticky- meaning a user who is accelerated will remain accelerated until the % accelerated slider value is changed.

The isAccelerated boolean value can be used to populate a property or dimension within your mobile analytics platform.

Here’s an example of how you might verify Neumob initialization and check whether a session is accelerated.

Neumob.initialize(getApplicationContext(),“NEUMOB_CLIENT_KEY", new Runnable() {
     public void run() {
         if (Neumob.isInitialized()) {
             // Neumob is ON.
             boolean isAccelerated = Neumob.isAccelerated();
             // ex. Analytics.logCustomDimension(Dimension.ACCELERATION, isAccelerated);
         } else {
             // Neumob is OFF. Change log settings for more details.


We do not recommend executing your own initialization code inside the runnable block. Also note that the runnable is not executed on the UI thread.

Disabling Neumob

If for any reason you are looking to disable Neumob, navigate to the portal to your app settings and select the combination of application versions and/or Neumob SDK versions that should be enabled. Once disabled, Neumob will not initialize on the client device.



The Neumob Android SDK has been verified with the following Android libraries:

  • OkHttp
  • Volley
  • VolleyPlus
  • Retrofit2
  • Glide
  • Universal Image Loader
  • Picasso
  • Fresco


1. The Neumob Android SDK uses the ProxySelector class. If you require setting your own default version you may consider waiting for support in the near future.

2. If you use 3rd party libraries like Google Analytics, we recommend adding those hosts to your a customizable blacklist you can find by navigating to your application on the portal.

3. For future versions if Neumob is not being updated properly while developing on Android studio try reinstalling as the jni libraries may cached.