Android Tutorial

(avery) #1
Android Tutorial 73

Creating an AVD with Google APIs


To have some fun with location-based services and maps
integration, you should use some of the Google applications often
available on Android handsets—most notably, the Google Maps
application. Therefore, you must create another AVD. This AVD
should have exactly the same settings as the AndroidVanilla2.2
AVD, with one exception: Its Target should be the Google APIs
equivalent for that API level (which is 8).You can call this AVD
Android
with_ GoogleAPIs_2.2.


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.)

  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.

Free download pdf