Grokking Android

Getting Down to the Nitty Gritty of Android Development

Using your Google Account in the Android Emulator

By 24 Comments

Whenever you need to access the People or Calendar app and want to add contacts or events you need an account. On the emulator though no account exists by default. So in this blog entry I am going to show you how to add your Google account to your emulator.

Update: Google has dropped support for the ActiveSync protocol (Exchange support) for new accounts.

For existing accounts the method in this post still works. For new accounts that’s no longer the case. Should I find a solution for new accounts, I will update this post.

First of all you have to go to the settings and select “Accounts & sync”:

Settings - Selecting "Accounts & sync"
Settings - Selecting "Accounts & sync"

You see the list of accounts – which in the emulator should be emtpy:

Accounts & sync - Showing no accounts
Accounts & sync - Showing no accounts

After you have clicked on “Add account” you will see the selection of sync providers available. In the emulator the following two should be listed. The first one is the Exchange sync adapter, the second one is for email only. So you should select the “Corporate” type:

Add an account - Selecting the account type
Add an account - Selecting the account type

In the next step you have to enter your Google-account credentials as usual:

Add an Exchange account - Entering your credentials
Add an exchange account - Entering your credentials

The next step is not that straightforward. To use your Google account as an Exchange account you first have to change the presented domain username to your email-address again. Android by default chooses another name based on the mail-address you entered before. But this default domain name does not work here.

You also have to change the server to “m.google.com“:

Account setup - Entering the account details
Account setup - Entering the account details

Now if you hit “Next” you are nearly done. You might want to check if the correct check marks are set, but the defaults should normally suit you well.

Account settings - Selecting sync settings
Account settings - Selecting sync settings

In the last step you can change the name of this account and after hitting “Next” once again, you are done.

Account setup - Setting the name of the account
Account setup - Setting the name of the account

Your newly created account is now listed in “Accounts & sync” screen and the initial synchronization has already been started. If you have mails or appointments you should notice notifications popping up soon. And your contacts and events should show up in the respecting apps.

Accounts & sync - Showing the new account
Accounts & sync - Showing the new account

From now on you can use the Calendar app to create and edit events on your device and have them synced with your account.

If you have any other suggestions that might help or tips on how to improve development on Android, please let me know in the comments section.

Wolfram Rittmeyer lives in Germany and has been developing with Java for many years.

He recently shifted his attention to Android and blogs about anything interesting that came up while developing for Android.

You can find him on Google+ and Twitter.