API Reference

Neumob Class

Neumob Accelerator SDK top-level class. Provides APIs to initialize the SDK and accelerate the network requests.

Public Methods

void initialize(Context context, String clientKey)

Initialize Neumob Accelerator SDK with the client key. Call this function during app launch typically at beginning of your onCreate activity or application.

Parameters

context Application context from getApplicationContext()
clientKey Application client key generated from Neumob portal. Must not be nil or empty.
void initialize(Context context, String clientKey, Runnable onComplete)

Initialize Neumob Accelerator SDK with the client key and executes the provided runnable on a background thread once the SDK is initialized. Call this function during app launch typically at beginning of your onCreate activity or application.

Parameters

context Application context from getApplicationContext()
clientKey Application client key generated from Neumob portal. Must not be nil or empty.
onComplete A block that is executed after Neumob Accelerator SDK is initialized.
boolean isAuthenticated()

Gets the authentication status of Neumob Accelerator SDK

Returns

Returns boolean value that determines if SDK is authenticated.

boolean isInitialized()

Gets the initialization status of Neumob Accelerator SDK

Returns

Returns a boolean value indicating SDK is enabled and ready to accelerate network requests.

boolean isAccelerated()

Gets the curent acceleration status of Neumob Accelerator SDK. You may configure whether or not Neumob SDK is accelerating requests by adjusting the % accelerated slider through the portal. Note that accelerated status is sticky meaning a user who is accelerated will remain accelerated until the % accelerated slider value is changed.

Returns

Returns a boolean value indicating if SDK is accelerating network requests.

okhttp3.OkHttpClient createOkHttp3Client()

Creates an instance of OkHttpClient. See OkHttp3

Returns

Returns an instance of OkHttpClient

okhttp3.OkHttpClient createOkHttp3Client(okhttp3.OkHttpClient.Builder builder)

Creates an instance of OkHttpClient using the provided Builder. See OkHttp3

Parameters

builder Builder configuration to use for creating OkHttpClient

Returns

Returns an instance of OkHttpClient

com.squareup.okhttp.OkHttpClient createOkHttpClient()

Creates an instance of OkHttpClient. See OkHttpClient

Returns

Returns an instance of OkHttpClient

retrofit2.Retrofit createRetrofit(String baseUrl)

Create an instance of Retrofit with the url. See Retrofit

Parameters

baseUrl API base URL

Returns

Returns an instance of Retrofit

retrofit2.Retrofit createRetrofit(retrofit2.Retrofit.Builder builder)

Create an instance of Retrofit using the configured values in the builder. See Retrofit

Parameters

builder Builder configuration to use for creating Retrofit

Returns

Returns an instance of Retrofit

void initializeWebView(WebView webView, Activity activity)

Initialize a WebView for collecting metrics. See WebView

Parameters

webView A WebView that needs to be initialized
activity An Activity where the WebView is hosted
void initializeWebView(WebView webView, Activity activity, WebViewClient client)

Initialize a WebView for collecting metrics. See WebView

Parameters

webView A WebView that needs to be initialized
activity An Activity where the WebView is hosted
client WebViewClient instance for handling any events at the application level
int getLogLevel

Gets the current log level used by the Neumob Acclerator SDK. See Logging

Returns

Returns current log level.

void reportKPIMetrics(String key, String value)

Sends the Key Performance Index (KPI) attributes to metrics endpoint.

Parameters

key Key name of the KPI metric.
value Value of the KPI metric.
void setLogLevel(int logLevel)

Set the log level used by the Neumob Accelerator SDK. See Logging

logLevel Log level to set.