OkHttp 2.2.x Integration


Neumob SDK supports OkHttp v2.2 and above. To use OkHttp2 with Neumob SDK, use Neumob.createOkHttpClient() method. To create an instance of OkHttpClient, use

OkHttpClient client = Neumob.createOkHttpClient();

instead of using OkHttp as below:

OkHttpClient client = new com.squareup.okhttp.OkHttpClient();

OkHttp UrlConnection

To use Neumob SDK with OkHttp UrlConnection, use NMOkUrlFactory to open a connection to an URL. Example:

// Create the URL factory
NNMOkUrlFactory factory = new NMOkUrlFactory();
// Open the URL connection
HttpURLConnection conn = factory.open(new URL("https://pdx.probe.neumob.net/weight1kb.test"));