16:跳过密码保存,因为用户可能会被提示使用 Android Autofill

问题描述

我正在将 google 智能锁集成到我的 android 应用程序中,但在某些设备中,我在尝试将凭据保存到 google 时遇到此错误。我正在使用以下代码来保存凭据 -

 Credential credential = new Credential.Builder(email)
                                       .setPassword(password)
                                       .build();
 saveCredentials(credential);

在谷歌上搜索解决方案后发现需要禁用应用程序中的自动填充功能以保存密码

尝试 1 - 将以下代码放入活动中,以便在特定活动中提交 autofillmager 并禁用自动填充。但它不起作用。

 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

    AutofillManager autofillManager = getSystemService(AutofillManager.class);
    autofillManager.commit();

    getwindow()
            .getDecorView()
            .setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS);
 }

尝试 2 - 将以下内容放入 EditText

属性
 android:longClickable="false"

longClickable 应该停止自动填充,但它不起作用。

 android:importantForAutofill="no"

也尝试使用 importantForAutoFill 但它也不起作用。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)