11

I have recently created an app which required certain security majors. One of which is that we need to stop the dialog coming from Google when a user logs into the app. The main thing is that password gets saved in google chrome. When a user comes to app again it shows options for the user to autologin with usernames in a list and adds password automatically so anyone gets access to the phone can log into the app and can steal the data.

Currently, this issue is found in only one One Plus 5 device. I want to stop this programmatically.

Any help would be appreciated,

Thanks

Update:

Thanks, Flyzzx, because of your reply I searched for android autofill and found out that it was introduced in Oreo to autofill data.

But when on the login screen it detects the username/password combo and prompts you for password save.

The solution to this is:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        AutofillManager autofillManager = getSystemService(AutofillManager.class);
        autofillManager.disableAutofillServices();
        editText.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO);
    }

Here, only autofillManager.disableAutofillServices(); is also sufficient but on some devices, you should also add editText.setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO); this to work. You have to do this for all edittexts which you don't want to get auto-filled.

Hope It will help others like me.

Gitesh
  • 163
  • 1
  • 3
  • 11
  • Have you tried with autocomplete="off" on the input ? See https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion – Flyzzx Jul 26 '18 at 12:37
  • Thanks Flyzzx but I want this on my Android App not on Mozilla – Gitesh Jul 26 '18 at 13:55
  • I'm not sure to understand. this is a native anroid app or a webview inside an android app ? because you add the google-chrome tag on your post. The link that have give you is available for all browser – Flyzzx Jul 26 '18 at 13:56
  • The reason to add a google-chrome tag is that password gets saved in chrome saved passwords. And yes my app is a native app. – Gitesh Jul 27 '18 at 08:39
  • I'm facing this issue. I tried your solution but stil that Popup comes. Did you do anything else?@Gitesh – Maulik Dodia Jan 20 '22 at 07:57

1 Answers1

1

You simply just add one property to your editText view

android:importantForAutofill="no"
Kishan Thakkar
  • 619
  • 6
  • 11