Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create custom account Android

What is the simplest way to create a custom account on Android? So far I've read the documentation: Creating a Custom Account Type, but it certainly didn't help a lot (too vague info). I tried reading the example from LastFm but certainly they did things a bit too much elaborately which I quite didn't understand well since I'm just an Android beginner with the accounts. I know its not as simple as calling:

final Account account = new Account(mUsername, your_account_type);
mAccountManager.addAccountExplicitly(account, mPassword, null);

because this would trow an exception.

So far I understood that I need to use an AccountAuthenticatorActivity and a service that works as authenticator. Any help that would point me in the right direction would be much appreciated.

like image 559
Raykud Avatar asked Jul 09 '12 23:07

Raykud


People also ask

How do I add an Authenticator to my Android phone?

Open the Authenticator app, select Add account from the Customize and control icon in the upper-right, and then select Work or school account. Select OR ENTER CODE MANUALLY. Enter the Code and URL from Step 1, and then select Finish. The Accounts screen of the app shows you your account name and a verification code.

What is Android account manager?

android.accounts.AccountManager. This class provides access to a centralized registry of the user's online accounts. The user enters credentials (username and password) once per account, granting applications access to online resources with "one-click" approval.


1 Answers

Did you checkout the sample sync adapter app? It's a little complicated and convoluted, but if you stick with it you can get things working. I've got a slightly simpler implementation in an android app I've been working on if you want to check that out as well.

Accounts are one of those things that I really wish android made a lot simpler. It used to be a poorly documented yet critical feature. They documentation seems to be getting better though.

like image 147
Kurtis Nusbaum Avatar answered Sep 23 '22 13:09

Kurtis Nusbaum