The lifeblood of our business is that R&D spend. There's nothing that flows through a pipe or down a wire or anything else. We have to continuously create new innovation that lets people do something they didn't think they could do the day before.

Steve Ballmer

Android: Account Manager: Step by Step

Looking for an Android Developer?

If you or your company are looking for an Android Developer contact us or read about our Android Development Service

Android: Account Manager: Step by Step key visual

This is the second page of Android: Account Manager: Step by Step

Implement an Authenticator service

The authentication service extends the abstract class. An android service forms a component of the main application that signals to Android that the application wants to preform some task that may be long running or not necessarily require user interaction. One example could be a synchronization or in our case authentication. The documentation states that a service can be used by other applications so in our case we are going to have Android's Account manager connect to our application to fetch the users online account details. 

Create a new class that extends the class.

Implement the onBind method to return an instance member of your AccountAuthenticator. 


import android.content.Intent;
import android.os.IBinder;

public class AuthenticatationService extends Service {
  public IBinder onBind(Intent intent) {
	// TODO Auto-generated method stub
	return new AccountAuthenticator(this).getIBinder();


This class is called by Android when the user clicks on your Account Authenticator in Android's Account Manager.

For now it will simply return back the account list when clicked. 

Create the account authenticator xml

Create a new xml file in the res/xml directory called "authenticator.xml" with the following content

Thanks: to Marko for pointing out the typo with android:smallicon and android:accounttype. The below code has been updated

Change the label to use your own label stored in your strings.xml.

If you want your application to have preferences add the following line


For more information on preferences please read Android: Application Preferences


Register the service in the AndroidManifest.xml

The 5th and final part to getting your Account Authenticator to display in Android's Account Manager is to register the the Authenticator Service with Android. This is done by adding the following lines to your AndroidManifest.xml file.


If you found this article useful, please be sure to check out the related articles below.

Marko Salonen commented:

Really good and easy tutorial. But there is a small typo in the xml that confuses a little bit :-)


android:accounttype should android:accountType



android:smallicon should be android:smallIcon

Thanks for the good tutorial! 

Adam Pullen commented:

Thanks Marko, 

I have updated the article.

Rahul Choudhary commented:

Great piece of work, really nice. Thanks for sharing this

sandy commented:

Hi ,

I'm 6month into android.I wanted to know how to add an account in account manager in android through our application step by step

Adam Pullen commented:


Hello Sandy,

I am currently working on a project where this adding an account via the application will be undertaken.

As I move through the project i will write articles.

Should be within the next 2 weeks.

I will send you an email when I have completed each one.



sandy commented:

Hi Adam,

I still didnt find solution for how to add an account in account manager

Adam Pullen commented:

Hello Sandy

Thanks for getting on to me about this.

I have finished the article on adding the account manager

sendi_t34 commented:

AccountAuthenticator(this).getIBinder() throws excepton

sendi_t34 commented:

what is the package for class
AccountAuthenticator(this) ? in 2.2

Adam Pullen commented:

Good question.

The AccountAuthenticator is your custom class that extends AbstractAccountAuthenticator.

You can find out more about this class by reading the first part of the article. Found in the link below.

I will update the article to include the "import" statement.

Ashwin commented:

Great piece of information.Very simple and informative!!! Just what i needed... :)

Alexander commented:

What theme is you using on your android making the background in the preferences screen in the android os white? Not the app you working with?

Pankaj Yadav commented:

Great information ,help me a lot ... thanks a lot 

Jason commented:

AuthenticatationService should probably be AuthenticationService :)

anu commented:

Hi Adam,

Thank you for such an article. Can i get the source code for this? I tried to add all the changes mentioned, but did not the link how addAccount will get called and how service is getting invoked?

Thank you so much for your help.


Adam Pullen commented:

Hey Anu,

here is the third part that discusses the link between the system and the addAccount

It is called by Android, basicly all you need to do is provide an activity that android will display to the user so that they can authenticate with your Server

john commented:

nice post

john commented:

nice post

Allis commented:

Nice post, I really like this post <a href="">ABC</a>

Allis commented:

Nice post, I really like this post <a href="">ABC</a>

Allis commented:

Nice post, I really like this post.

Johny commented:

Education is not anything, on the behalf of which we can blindly trust anyone as if such person is educated then he must be right and better in the field of everything and every matter.

Alison commented:

 I always looking for finding new information and you help me with sharing this article with everyone. Buy essay

Alison commented:

 I always looking for finding new information and you help me with sharing this article with everyone. pay someone to write my essay

Add a comment

Your email will not be published