Prevent android from saving and retrieving passwords when typing on EditText

自作多情 提交于 2019-12-24 02:55:12

问题


How can I prevent this from happening, multiple users are going to use the app on the same device and I do not want all of them having access to some places


回答1:


You simply just add one property to your editText view

android:inputType="textPassword|textNoSuggestions"

and you are done.

if it is not working for you there is another alternative solution. You can turn off autofill programmatically.

You can try to this.

public class BaseActivity extends AppCompatActivity {

     @Override
        public void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           disableAutoFill();
        }

        @TargetApi(Build.VERSION_CODES.O)
        private void disableAutoFill() { 
            getWindow().getDecorView().setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS);
        }
    }



回答2:


This worked for me https://www.addictivetips.com/android/google-autofill-settings-for-apps-android/

Disabling the autofill from Google, but I did not find how to do it just for my app



来源:https://stackoverflow.com/questions/52961540/prevent-android-from-saving-and-retrieving-passwords-when-typing-on-edittext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!