开发者

How can I use AccountManager in Android with Google Account?

I want to use AccountManager in Android, to verify a com.google account. I've already know how to get the account, But I've got several questions,

  1. If the account is not in AccountManager, and the account self is under com.google domain, then how can I add it?
  2. How AccountManager manage tokens? It retrieves tokens automatically, or I need to do it manually?
  3. I'm trying to use Google Reader API with ClientLogin, then I may need password for the first time. If some com.google accounts are stored previously by other apps, can I use them to get the password?

Edit on 2011.08.20

To clarify the question, what I want to ask it this,

  1. Google applications on Android has its own routine to verify Google accounts, and I want to know whether it's possible to call the routine created by Google applications, and get my own authority?
  2. If there's no Google Account on Android phone, how can I add an account, which will be a开发者_如何学Cccepted by Google applications later?


If the account is not in AccountManager, and the account self is under com.google domain, then how can I add it?

If you simply want to have, for example, a button that lets the user add a Google account, consider invoking the ADD_ACCOUNT intent. Another, more advanced, option is to use AccountManager.addAccount.

How AccountManager manage tokens? It retrieves tokens automatically, or I need to do it manually?

The system manages tokens. Well, actually, applications register 'authenticators' which manage tokens for their corresponding service. An authenticator for Google accounts comes preloaded with most Android devices, and third party apps like Twitter add their own authenticators when installed. Apps that want to use Google accounts can request authentication tokens using AccountManager.getAuthToken.

I'm trying to use Google Reader API with ClientLogin, then I may need password for the first time. If some com.google accounts are stored previously by other apps, can I use them to get the password?

Your app should never ask the user for her Google password. Use the relevant AccountManager methods to request an auth token for Reader. Unfortunately, since Google Reader doesn't have a public API I can't assist further.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜