I’m working on an Android app. I want to make the password manager on Android (Samsung device) usable with my login form.
I’m testing the app via USB debugging on an older Samsung phone. According to the logs, autofill service starts but then aborts because no credentials are found. Also, after logging in, the password manager never asks me to save the credentials.
My goal is that when I log out or exit the app, I don’t have to type everything again instead, the Samsung password manager should remember my credentials and autofill them next time I open the app.
Here is my login method in TypeScript:
public doLogin(param: { username?: string; password: string }) {
if (this.formIsDisabled) {
return;
}
param = LoginComponent.preprocessCredentials(param.password, param.username);
this.formIsDisabled = true;
this.websocket.login(new AuthenticateWithPasswordRequest(param))
.finally(() => {
this.formIsDisabled = false;
});
}
And this is a simplified snippet of my login form’s HTML:
<form>
<input
#username
name="username"
type="email"
autocomplete="username"
/>
<input
#password
name="password"
type="password"
autocomplete="current-password"
/>
<button type="submit" (click)="doLogin({ username: username.value, password: password.value })">
Login
</button>
</form>
I’ve tried many variations with ngSubmit, normal submit, click events, proper name attributes, and form tags, but I’m still unsure if I’m using the form tags correctly or if I’m missing something.
I also tried adding Autofill-related code in the Android MainActivity of my Capacitor app, but it didn’t help.
Does anyone have advice or examples on how to properly set up Angular + Capacitor to work well with Android password managers?
Thanks in advance!