0

I have a WebView App which opens a website's login page as its first page ! and now I want to Save User's Login Information So They Don't Have to Put their Credentials Every Time they Open The app but because of some security issues I don't want to keep users logged in after they kill the app !! How can I do this ?? Thank You All In Advance !

aliirezap
  • 111
  • 1
  • 1
  • 6
  • This may be help you https://www.tutorialspoint.com/how-to-save-password-in-android-webview – Noban Hasan Jun 30 '20 at 06:57
  • @NobanHasan So it says adding only `web_view.getSettings().setSavePassword(true);` would be enought ? And how about username? – aliirezap Jun 30 '20 at 08:15

1 Answers1

0

This example may help you. Add this code snippet inside your code.

CookieSyncManager.createInstance(this);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);

WebView webview = new WebView(this);
WebSettings ws = webview.getSettings();
ws.setSaveFormData(true);
ws.setSavePassword(true); 
ws.setDomStorageEnabled(true);
ws.setJavaScriptEnabled(true);

Reference :https://stackoverflow.com/a/48234172/8332511

Noban Hasan
  • 593
  • 1
  • 7
  • 21