I know we can save email and password (Android/Google password manager/ auto fill service) if signing in the app and keyboard can suggest saved accounts
But if a user installs the app for the first time, how can we suggest an email from the system/Google account without password and without typing nothing at all?
For now I need to start typing some email before keyboard suggests the email
Update
Found the following example:
@Composable
fun AutofillEmail() {
var email by remember { mutableStateOf("") }
val autofillNode = AutofillNode(
autofillTypes = listOf(AutofillType.EmailAddress),
onFill = { email = it }
)
val autofill = LocalAutofill.current
LocalAutofillTree.current += autofillNode
OutlinedTextField(
modifier = Modifier.onGloballyPositioned {
autofillNode.boundingBox = it.boundsInWindow()
}.onFocusChanged { focusState ->
autofill?.run {
if (focusState.isFocused) {
requestAutofillForNode(autofillNode)
} else {
cancelAutofillForNode(autofillNode)
}
}
},
value = email,
onValueChange = { email = it }
)
}
but it only works for Google Autofill service:
On Samsung devices the default Autofill service is Samsung Pass
but nothing appears
Why Samsung doesn't suggest to autofill email of my Samsung account at least? My device is signed in to both Google and Samsung accounts...