Obsolete
Status Update
Comments
am...@google.com <am...@google.com>
am...@google.com <am...@google.com> #2
Thank you for the feedback. We’ve shared this with our product and engineering teams for the possible consideration
[Deleted User] <[Deleted User]> #3
I am stuck in a situation where i request autofill on my edit text and if there is no auto fill available , it is giving a weird toast message "no auto fill suggestions available". Is there a way to tackle this ?
Any help would really be appreciated . Thanks in advance
Steps to repro:
private fun showAutoFillSuggestion(view: View) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { val autofillManager = requireContext().getSystemService(AutofillManager::class.java) if (autofillManager.isAutofillSupported && autofillManager.isEnabled) { autofillManager?.requestAutofill(view) } } }
Since there are no autofill suggestions available it is giving that toast message, is there something i can do to fix this issue ?
ba...@google.com <ba...@google.com> #4
Thank you for your feedback. We assure you that we are doing our best to address all issues reported. For now, we will be closing the issue as won't fix obsolete.
Description
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/phoneNumberEditText" android:layout_width="match_parent"
android:layout_height="wrap_content" android:autofillHints="phone"
android:hint="@string/phone_field_hint" android:imeOptions="flagNoExtractUi"
android:importantForAutofill="yesExcludeDescendants" android:inputType="phone" />
We also have a way to request Google to show the user a dialog to choose a phone number from:
val hintRequest = HintRequest.Builder().setPhoneNumberIdentifierSupported(true).build()
val intent = Auth.CredentialsApi.getHintPickerIntent(googleApiClient, hintRequest)
try {
startIntentSenderForResult(intent.intentSender, REQUEST_PHONE_NUMBER, null, 0, 0, 0);
} catch (e: IntentSender.SendIntentException) {
Toast.makeText(this, "failed to show phone picker", Toast.LENGTH_SHORT).show()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == REQUEST_PHONE_NUMBER) {
if (resultCode == Activity.RESULT_OK) {
val cred: Credential? = data?.getParcelableExtra(Credential.EXTRA_KEY)
phoneNumberToSendTo = cred?.id ?: ""
if (phoneNumberToSendTo.isEmpty())
Toast.makeText(this, "failed to get phone number", Toast.LENGTH_SHORT).show()
else
onGotPhoneNumberToSendTo(phoneNumberToSendTo)
}
}
}
However, we don't know when we should show it. If auto-fill is presented to the user for this type of data (phone number), we don't want to show the dialog in addition to what's already offered.
The only API we have for checking about the status of auto-fill, is if it's enabled:
In this case, it doesn't let us know if it's enabled for this type of data or not. We might have autoFillManager.registerCallback , but this only tells us when we actually have the EditText and when it has a focus. It won't work when we don't have an EditText or when it doesn't have a focus. Plus it gets called only when it gets shown instead of just telling us "yes, we have some auto-fill data for this type" (and the opposite).
Please add API query to check if for a specific type of data we will have auto-fill suggesting the user what to fill it with, so that we could avoid showing the phone-picker of Google in this case.