Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AccountManager.addAccountExplicitly return false in Some Android Phones

In my app, there is an account creation section after login which is normally used for syncing app data with remote data.

But if phone is in unstable state,it wont create account and AccountManager.addAccountExplicitly return false.But when i check the account[],it is returning length as 1

 AccountManager accountManager = AccountManager.get(this);
                Account[] accounts = accountManager.getAccountsByType("com.sample.account");
                if (accounts.length == 0)
                {
                    addAccountAndSync();
                }

But app is not shown in "Accounts" in Phone Settings. Anybody came across this situation.?

like image 291
KP_ Avatar asked Nov 01 '22 10:11

KP_


1 Answers

Was hitting this on N preview (https://code.google.com/p/android/issues/detail?id=210466). Forcing a removeAccount and calling addAccountExplicitly again is a temporary workaround until they fix it.

like image 176
DallinDyer Avatar answered Nov 11 '22 08:11

DallinDyer