【发布时间】:2017-10-26 17:53:49
【问题描述】:
我知道在 8.0 中,首选自动填充,但我想强制使用 Google Smart Lock 保存对话框。实施时出现此错误:
{Status{statusCode=The Credentials API's save confirmation dialog has been disabled to avoid conflicts with the Android Autofill feature. This choice may be overridden via AuthCredentialsOptions.Builder.forceEnableSaveDialog()., resolution=null}}
但在 Android docs 中,没有这种方法。在 Google 搜索中或在文档中的搜索中找不到这个 forceEnableSaveDialog() 方法。
有谁知道如何在 8.0 设备上强制执行此对话框?我希望我的应用在不同版本中的行为保持一致。
SaveCredentials 代码片段:
mCredentialsApiClient = new GoogleApiClient.Builder(Xamarin.Forms.Forms.Context)
.AddConnectionCallbacks((obj) =>
{
var credendial = new Credential.Builder(userName).SetPassword(password).Build();
Auth.CredentialsApi.Save(mCredentialsApiClient, credendial).SetResultCallback(new ResultCallback<IResult>((obj2) =>
{
Print("Saved");
if (obj2.Status.IsSuccess)
{
Print("Credentails successfully saved with Google Smart Lock");
}
else if (obj2.Status.StatusCode == CommonStatusCodes.ResolutionRequired)
{
obj2.Status.StartResolutionForResult(CrossCurrentActivity.Current.Activity, obj2.Status.StatusCode);
}
}));
})
.AddOnConnectionFailedListener(NotConnected)
.AddApi(Auth.CREDENTIALS_API)
.Build();
mCredentialsApiClient.Connect();
这是 Xamarin 中的 Android。相同的方法和所有内容,只使用 C#
【问题讨论】:
-
你能告诉我你目前拥有的代码吗?
-
我为我保存的位置添加了一个 sn-p 代码。返回的 obj2.Status 是这条消息的来源
标签: c# google-api xamarin.android android-8.0-oreo google-smartlockpasswords