相关疑难解决方法(0)

禁用应用程序的Android O自动填充服务

Android O具有支持字段自动填充的功能.有什么办法可以为特定的应用程序禁用它.那是我想强制我的应用程序不使用自动填充服务.

可能吗 ?

要阻止整个活动的自动填充,请在活动的onCreate()中使用:

getWindow()
  .getDecorView()
  .setImportantForAutofill(View.IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS);
Run Code Online (Sandbox Code Playgroud)

有没有比这更好的方法?

android autofill textview android-8.0-oreo android-autofill-manager

34
推荐指数
4
解决办法
2万
查看次数

Google智能锁定对话框未出现在Android O设备中

我最近将GoogleSmartLock与我的应用集成在一起.不知何故,Android O设备中没有出现保存对话框,并且API引发了以下错误.

已禁用Credentials API的保存确认对话框,以避免与Android自动填充功能发生冲突.可以通过AuthCredentialsOptions.Builder.forceEnableSaveDialog().,resolution = null}覆盖此选项.

我检查了playservices的最新发行说明,发现以下API可以解决这个问题.

Auth.AuthCredentialsOptions.Builder forceEnableSaveDialog ()
Run Code Online (Sandbox Code Playgroud)

但是我不知道如何将这个api与GoogleApIClient一起使用,因为它没有在技术上应该返回AuthCredentialOptions实例的构建方法.如果有人遇到同样的问题,请告诉我.

android google-smartlockpasswords android-8.0-oreo

11
推荐指数
1
解决办法
1363
查看次数

启用自动填充时,不会使用 Smart Lock API 保存密码凭据

我目前正在 Android 应用程序中实现密码智能锁,我正在遵循文档: https: //developers.google.com/identity/smartlock-passwords/android/store-credentials

在 android Oreo 及以上版本中有此自动填充功能,并且我确实在字段中看到了自动填充弹出窗口,我的问题是在尝试保存凭据时,出现错误:

16: Credentials API's save confirmation dialog has been disabled to avoid conflicts with the Android Autofill feature. This choice may be overridden via CredentialsOptions.

我在其他帖子中读过,这是一个预期的错误,它是为了防止它所说的conflicts with the Android Autofill feature,但我没有看到任何其他对话框来确认保存凭据。

我尝试使用模拟器和真实设备,得到相同的结果。然后我尝试按照文档强制显示智能锁密码保存对话框:

构建 CredentialsClient 时,通过 CredentialsOptions 为所有平台启用保存确认对话框。

CredentialsOptions options = new CredentialsOptions.Builder()
        .forceEnableSaveDialog()
        .build();
mCredentialsClient = Credentials.getClient(this, options);
Run Code Online (Sandbox Code Playgroud)

通过将与登录字段关联的根视图标记为对自动填充不重要来抑制自动填充保存对话框:

<!-- Mark the root view with android:importantForAutofill="noExcludeDescendants" -->
<LinearLayout
    android:importantForAutofill="noExcludeDescendants"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <!-- ... -->
</LinearLayout>     
Run Code Online (Sandbox Code Playgroud)

我做到了并且成功了,保存时显示了对话框,但是自动填充功能消失了(如预期的那样),而且我需要弹出窗口,这是我的要求的一部分。

我还尝试仅应用CredentialsOptions options …

android autofill google-smartlockpasswords

1
推荐指数
1
解决办法
1691
查看次数