'How to integrate autofill in Jetpack Compose
I want to provide some autofill functionality in my app (email and password) that is written completely using Jetpack compose. I came across this blog post and this demo code which I both tried out. Unfortunately, I can't get any popup when interacting with the text fields.
After modifying my code, I ended up using the provided demo. A minimal example looks like this (the ExplicitAutofillTypesDemo
composable is taken from the demo code mentioned above without any modification):
class MainActivity: AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
ExplicitAutofillTypesDemo()
}
}
}
What am I missing? Do I need to enable it somewhere else? The official compose autofill documentation is not very helpful. I only want to get a autofill popup when touching a text field like in the blog post above.
Solution 1:[1]
In my case, the popup was not showing due to the fact that autofill doesn't seem to work with any other provider than Google. The debug log shows the following message:
D/Autofill Status: Autofill popup isn't shown because autofill is not available.
Did you set up autofill?
1. Go to Settings > System > Languages&input > Advanced > Autofill Service
2. Pick a service
Did you add an account?
1. Go to Settings > System > Languages&input > Advanced
2. Click on the settings icon next to the Autofill Service
3. Add your account
I tried the Microsoft Authenticator as an example which does not work. When I switch to Google, everything works as intended.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | stkent |