I am trying to edit my android application so that the user does not need to log in after they have logged in once, even if they close the application.
I have been referencing this link below:
How to save a cookie in an android webview forever
as well as the official documentation, but I just am not "getting" how to do this. Can anyone help me in understanding what I need to do?
here is my code: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
mWebView = (WebView) findViewById(R.id.activity_main_webview);
mWebView.setWebViewClient(new WebViewClient());
CookieManager.getInstance().setAcceptCookie(true);
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().startSync();
// Enable Javascript
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
mWebView.loadUrl("https://app.dhanvapasi.com");
}