Http session is always created on Android version ModernHttpClient (okHttp1.5)

Please note that both platforms use the HttpClient code below. However, the native message handler varies depending on the device: Android using OKhttp1.5 and IOS NSurlSession, which is a handle from the ModernHttpClient library.

My problem is on an Android device, the session is always created on the server every time the request is called, and it should not.

However, on iOS, the session remains until the session timeout expires, which helps improve performance.

Is there something I need to do for the Android version specifically to save the session cookie?

Thank!

private static HttpClient _mobileService = null;
public static HttpClient MobileService
{
    get
    {
        if (_mobileService == null)
        {
            NativeMessageHandler nmh = new NativeMessageHandler();
            _mobileService = new HttpClient(nmh);
        }

        return _mobileService;
    }
    set
    { 
        _mobileService = value;
    }
}
+4

All Articles