Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I apply the Android Oreo(8.0) Autofill framework to WebView?

https://developer.android.com/about/versions/oreo/android-8.0-changes.html#all-apps

Web form autofill

Now that the Android Autofill Framework provides built-in support for autofill functionality, the following methods related to WebView objects have changed for apps installed on devices running Android 8.0 (API level 26):

WebSettings

  • The getSaveFormData() method now returns false. Previously, this method returned true instead.
  • Calling setSaveFormData() no longer has any effect.

WebViewDatabase

  • Calling clearFormData() no longer has any effect.
  • The hasFormData() method now returns false. Previously, this method returned true when the form contained data.
like image 711
kyh Avatar asked Sep 01 '17 01:09

kyh


People also ask

How do I turn on autofill on Android?

Users can enable or disable autofill as well as change the autofill service by navigating to Settings > System > Languages & input > Advanced > Input assistance > Autofill service.

Which method is used to load webpages WebView?

The loadUrl() and loadData() methods of Android WebView class are used to load and display web page.

How does autofill work in Android?

Some apps, such as password managers, can fill out the views in other apps with data previously provided by the user. These apps that fill out other apps are called autofill services. The autofill framework manages the communication between an app and an autofill service.


1 Answers

This is the basic example to force an autofill request

public void eventHandler(View view) {
    AutofillManager afm = context.getSystemService(AutofillManager.class);
    if (afm != null) {
        afm.requestAutofill();
    }
}

check the complete documentation

like image 140
josedlujan Avatar answered Sep 21 '22 17:09

josedlujan