Misamoto
Misamoto

Reputation: 663

Using AccountManager for 3rd party service

I understand what AccountManager is needed for, and somewhat understand how to use and implement it. However I've yet to understand if I would be right to use it, if I don't own, or even am associated with the service that I authenticate my app with. I'm writing an app that consumes a REST service, with OAuth2 authorization. The company that created said service doesn't use AccountManager for their own app.

StackOverflow suggestions actually found one similar question, but the answer to it is really late to the party, and I don't have any indication that it's right.

Upvotes: 1

Views: 40

Answers (1)

Marten
Marten

Reputation: 3862

This decision doesn't depend so much on whether the service is run by you or any 3rd party.

There are only two (strong) reasons for having an Authenticator:

  1. If you want to sync contacts or calendar data there must be an Authenticator for the account type, otherwise you can't sync them. If the service operator doesn't provide any Authenticator for the service in his own app you need to implement it yourself.

  2. If want to give other apps the option to authenticate with this service by using your Authenticator. That's usually only the case if you're the service operator.

If you only want to authenticate users within your own app you don't have to implement an Authenticator. If the service operator doesn't provide an Authenticator or it's not available on most devices, just implement your own custom authentication module or use any existing library that suits your needs.

Anyway, you're certainly free to implement an Authenticator if you want to. Just make sure the account type is unique and doesn't collide with any current or future app. The easiest and most common way to achieve this is by adding your app's package name like so your.package.name.ACCOUNT.

Upvotes: 1

Related Questions