Android AccountManager addAccountExplicitly method returns false only for one user


Android AccountManager has been used on our app since 2017 implemented by the earlier devs. Recently we found out that a particular user had problems with login. It took us weeks and we really could not find any anomalies in the BE response. We requested him to come to our office and we debugged on his device suspecting it could be a device specific issue as our other 1m+ users never reported an issue like this. So this is the flow:

We call a login API. It returns the user data object and we save it in the account manager like this:

Account account = new Account(user.getClientId(), type);
Bundle userdata = new Bundle();

We put all the user data object items into the bundle and save it like this:

accountManager.addAccountExplicitly(account, user.getPassword(), userdata);

The earlier developers made a mistake of not checking the return boolean response of this method. So after a lot of debugging we found out that

accountManager.addAccountExplicitly

returned false on his device but true on our test devices.

Since the add returned false, all the subsequent API calls needed a token and ID which was not available due to the failure while saving into AccountManager. So the user was stuck on the first step itself.

We also tried to use deleteAccountExplicitly but his device is unable to find this account and add acount fails because the device thinks it exists.

Has anyone encountered issues with AccountManager before? Are there better alternatives to try out?

0
Aug 20 at 4:00 AM
User AvatarKsiAndroid
#android#accountmanager

No answer found for this question yet.