DISPLAYING MAPS

Google Maps is one of the many applications bundled with the Android platform. In addition to simply using the Maps application, you can also embed it into your own applications and make it do some very cool things. This section describes how to use Google Maps in your Android applications and programmatically perform the following:

  • Change the views of Google Maps
  • Obtain the latitude and longitude of locations in Google Maps
  • Perform geocoding and reverse geocoding (translating an address to latitude and longitude and vice versa)
  • Add markers to Google Maps

Creating the Project

To get started, you need to first create an Android project so you can display the Google Maps in your Android application.

TRY IT OUT: Creating the Project

codefile LBS.zip available for download at Wrox.com

1. Using Eclipse, create an Android project as shown in Figure 4-1. Be sure to check the Google APIs checkbox in the Build Target section.

image

NOTE In order to use Google Maps in your Android application, you need to ensure that you check the Google APIs as your build target. Google Maps is not part of the standard Android SDK, so you need to find it in the Google APIs add-on, as was discussed in Chapter 1.

2. Once the project is created, observe the additional JAR file ( ...

Get Beginning Android now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.