create custom account Android
Asked Answered
R

1

8

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.

Regularly answered 9/7, 2012 at 23:7 Comment(1)
This post on stackoverflow might also be helpful: https://mcmap.net/q/11434/-how-to-add-programmatically-a-custom-account-in-android/39686087#39686087.Chromoprotein
B
6

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.

Bellina answered 9/7, 2012 at 23:45 Comment(2)
I've been checking the sample sync adapter app and having a hard time with it but it certainly made me understand a bit better, however is not yet as clear as water. I'll try your app to try to understand, thanks for sharing, and if it makes me get things clear I'll accept the answer :)Regularly
certainly your proyect helped me a lot to understand it O_O thanks a lot. The best part is that you had it organised so it wasnt dificult to find :PRegularly

© 2022 - 2024 — McMap. All rights reserved.