2

I would like to disable Autofill in an Android WebView in Oreo but I cannot find a way to do that. I have tried AutofillManager.disableAutofillServices and cancel() in the app. I created an onAutofillEvent() listener in the app and it does not get called when Autofill is used in the WebView.

Does anyone know how to this?

I found my answer in this post. Not sure why I didn't find it before I asked.

Paul
  • 49
  • 1
  • 4
  • 1
    Have you tried calling `setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO)`? See [this blog post](https://commonsware.com/blog/2017/06/13/securing-apps-android-8p0-autofill.html) for more. – CommonsWare Jan 08 '18 at 19:20
  • Just did tried it before I saw your comment. Thanks anyway! – Paul Jan 08 '18 at 19:55
  • If you are saying that it did not work... that's bad. Is the content that you are loading into the `WebView` something public? I'd like to try to reproduce your scenario. – CommonsWare Jan 08 '18 at 19:56
  • I'm sorry. Yes, it did work. Thanks again. – Paul Jan 09 '18 at 19:59
  • Whew! You had me scared for a bit! :-) Glad to hear that you have it working. – CommonsWare Jan 09 '18 at 20:01
  • The solution from the blog post is not working for me. Could you provide more details about your implementation? I have tried setImportantForAutofill both in the onCreate from the Activity that contains the Webview, and the Webview itself. – Fran J Martínez Aug 31 '18 at 12:56
  • I also need the solution, if you can, please help us. – Ionuț Popescu Sep 01 '18 at 21:54
  • 2
    I did what the referenced post described in my onCreate in the activity that contains the WebView: `webview = findViewById(R.id.webview); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { webview.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO); }` – Paul Sep 04 '18 at 14:43
  • 1
    Paul's code in previous comment doesn't work for me. I also tried `getWindow().getDecorView().setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS);` as well as `android:importantForAutofill="noExcludeDescendants"` to no avail, for Android 10 and Android 8 phones. – Brian Hong Jan 24 '20 at 16:27

0 Answers0