I login to a server using okhttpclient.
static OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder().url(url).build();
Response response = client.newCall(request).execute();
The server has a login php page which creates a session for me. Then, I use webView client to open and display pages within the server in my app.
wv1 = (WebView) findViewById(R.id.webView);
wv1.setWebViewClient(new MyBrowser());
wv1.getSettings().setLoadsImagesAutomatically(true);
wv1.getSettings().setJavaScriptEnabled(true);
wv1.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
wv1.loadUrl(url);
But it redirects to the login screen, which can only happen if I don't have a valid session. So I need a way to store the session during my initial login and maintain it so that I can use it to display the pages without redirecting to login. I'm using okhttp for login and webview for pages. If I use okhttp for pages, it returns the page source. Can it be used to display webpages, or any other workaround? I'm stuck on this for the past few days. Any help would be highly appreciated.