When i login with [email protected] in my application.It generate account successfully with my email like this
Now i logout and login with different email like [email protected] then it generate account like this
I want to know that which is the best way
1) Remove first account and add second account
2) Update first account with second if it is possible to update it.
What is Problem I am getting actually?
If I remove and again add account using addAccountExplicitly it takes some time for creating new account so my next code is executed and account returns null.
Is is possible to update account using the help of updateCredentials if yes then how ??
Edited:
What I do actually?
Creating bundle with required data for account
Checking whether account already exists with local inserted bundle params "global_user_id", If it is already exists then I have to update EMAIL which is used as login (see above images.)
Currently I am doing as, Removing old account and Adding new Account, but next line is for SyncAdapter Configuration which needs account. In that getting NULL because adding account takes some time in background.
Is there any other solution to update that Email Id?


I got solution of this problem.
Question: Removing/Adding Account remains null
accountobjectSolution 1:
First I removed account using
removeAccount()and then tried toaddAccountExplicitlyBUTremoveAccount()taking time to execute in background thread while addAccountExplicitly called and doing further process.So I changed my flow, as I used
removeAccountmethod of AccountManager class and doing whole process in that handler, So I write my code inside the callback area.Solution 2:
I found method called renameAccount() but it require minimum sdk version 21. As per docs:
Thank you.