loading...

Answer: How to use Android autofill API

mayank1513 profile image Mayank ・1 min read

A simple solution would be to let webview handle this.

webView.getSettings().setSaveFormData(true);

    webView.getSettings().setJavaScriptEnabled(true)
    webView.getSettings().setPluginState(WebSettings.PluginState.ON);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setDisplayZoomControls(true);
    webView.setWebChromeClient(new WebChromeClient() /*Or yourOwnWebChromeClient*/);
    webView.setWebViewClient(new WebViewClient() /*Or yourOwnWebViewClient*/);
    webView.getSettings().setDomStorageEnabled(true);
    webView.getSettings().setSaveFormData(true);

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

You may also add JavaScript Interface if needed

    webView.addJavascriptInterface(this, JSInterface);

I used this approach and it saved the…

Discussion

markdown guide