Setting Your Location in the Android Emulator

It seems almost all of the Apps I write these days are location aware in some regard.  I’ve written here about the new iOS Simulator’s location setting and wanted to show the same for the Android Emulator.

There are several different ways to sent the emulator’s location information. Since I use a few different development environments I like to use Terminal since it let’s me keep the same workflow no matter the development platform.

Step 1: Platform Tools

Open Terminal and go to your AndroidSDK / platform-tools directory.  Android let’s you call the directory you install the Android SDK into anything. For this example, I’m using the name AndroidSDK.

 Platform Tools Directory

Step 2: Finding Attached Devices

The adb utility allows us to query all of the devices (and emulators) that are currently attached to the system.  To do this we use the adb devices command as shown below.

adb command

After pressing enter you will see a list of all the devices linked to the system.  In this case there is only the emulator shown below. 

ado device output

 

Step 3: Connect To Emulator

Using the information above we can telnet into the emulator using the below command.

Telnet connection command

This will connect you to the emulator as shown below.

Telnet connection Message

This allows us to connect to the emulator directly and issue commands.

Step 4: Geo Fix A Location

Now we’ve connected to the emulator, we can use the geo fix command to set our location coordinates.  The below example shows setting the coordinates for Time Square in New York City.

Geo Fix Your Location

The format is:

geo fix command format

You can read more about the different geo commands at the bottom of this page.

 

Video Walk Through

Here is a short video walk through of the above steps:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s