When my app starts, I'd like to ask my users either to create an Account or to choose from existing ones. I've implemented an Authenticator (extended AccountAuthenticatorActivity, AbstractAccountAuthenticator, made a Service) It seems to be working, I can create new Accounts from Settings/Accounts.
When I start an AccountPicker, I get a list of already created Accounts. When I click Add acccount it shows up my Account creation Activity. But when I'm done with account creation, finishing that Activity, and going back to the AccountPicker I dont see a new option of the newly created Account. Although if I restart the app, the recently created Account is in the list.
How I start the AccountPicker:
Intent intent = accountManager.newChooseAccountIntent(null, null, new String[]{"test_namespace"}, null, null, null, null);
startActivityForResult(intent, TEST_CODE);
My questions:
- Is it supposed to work like this?
- Can I reload the content of the
AccountPickerafter I created a newAccount? - Can I just simply return an
Intentwith the newly createdAccountwhen I return from myAccountcreationActivity?
In my authenticator activity, after the user authenticates on the server I check the existing accounts and explicitly add the account if it's not there:
After I do this, I see the account in the account picker.
I can't guarantee this is 100% correct; with the undocumented authentication classes, we're all flying blind.