create custom account android

ぐ巨炮叔叔 提交于 2019-12-04 11:08:12

问题


Whats 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 elaborated wich I quite didn't understand well since I'm just an Android begginer 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.


回答1:


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.



来源:https://stackoverflow.com/questions/11404504/create-custom-account-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!