Configuring the Location of the Emulator

After you have created a new AVD with the Google APIs support, you need to shut down the emulator you've been running. Then debug the My First Android App application again, this time choosing the new AVD.

The emulator does not have location sensors, so the first thing you need to do is seed your emulator with GPS coordinates.To do this, launch your emulator in debug mode with an AVD supporting the Google Maps add-ins and follow these steps: In the Emulator:

1. Press the Home key to return to the Home screen.

2. Launch the Maps application from the Application drawer.

3. Click the Menu button.

4. Choose the My Location menu item. (It looks like a target.)

In Eclipse:

5. Click the DDMS perspective in the top-right corner of Eclipse.

6. You see an Emulator Control pane on the left side of the screen. Scroll down to the Location Control.

7. Manually enter the longitude and latitude of your location. (Note they are in reverse order.)

8. Click Send.

To find a specific set of coordinates, you can go to http://maps.google.com. Navigate to the location you want; center the map on the location by right-clicking the map. Choose Link to Map and copy the URL. Take a closer look at the URL and weed out the ll variable, which represents the latitude/longitude of the location. For example, the Yosemite Valley link has the value 11=37.746761, -119.588542, which stands for Latitude: 37.746761 and Longitude: -119.588542.

Back in the emulator, notice that the Google Map now shows the location you seeded. Your screen should now display your location as Yosemite Valley, as shown in Figure 3.16. Your emulator now has a simulated location.

Easy Software Profits

Easy Software Profits

Here's How Anyone Can Start, Build and Run their Own Successful Software Empire Without Knowing the First Thing About Programming, Scripting Or Any 'Coder' Stuff. There is no doubt about it software sells. Software has a high percieved value and it solves problems for people.  A claim that can't always be made for PDF books, Video products and the like.

Get My Free Ebook


Post a comment