Introduction to the Google Maps Android API v2
With the Google Maps Android API, you can add maps based on Google Maps data to your application. The API automatically handles access to Google Maps servers, data downloading, map display, and response to map gestures. You can also use API calls to add markers, polygons, and overlays to a basic map, and to change the user's view of a particular map area. These objects provide additional information for map locations, and allow user interaction with the map. The API allows you to add these graphics to a map:
- Icons anchored to specific positions on the map (Markers).
- Sets of line segments (Polylines).
- Enclosed segments (Polygons).
- Bitmap graphics anchored to specific positions on the map (Ground Overlays).
- Sets of images which are displayed on top of the base map tiles (Tile Overlays).
This conceptual documentation is designed to let you quickly start exploring and developing applications with the Google Maps Android API. You may also wish to refer to the reference documentation for specific details of classes and methods.
Google Maps Mobile SDK for Business
The Google Maps Mobile SDK for Business license provides enhanced capabilities for both the Google Maps SDK for iOS and the Google Maps Android API. If you have purchased a Google Maps Mobile SDK for Business license, please refer to the Google Maps API for Business documentation for additional, supplementary information.
If you use the Google Maps Android API in your application, you must include the Google Play Services attribution text as part of a "Legal Notices" section in your application. Including legal notices as an independent menu item, or as part of an "About" menu item, is recommended.
The attribution text is available by making a call to
A demo app is bundled with the Google Play services SDK. You can use it for sample code and to view the demo.
The instructions below assume that you are using the Android Developer Tools (ADT) plugin in Eclipse.
First you must add Google Play services as an Android library project as follows:
- Select File > Import > Android > Existing Android Code Into Workspace and click Next.
- Select Browse, enter
<android-sdk-folder>/extras/google/google_play_services/libproject/google-play-services_lib, and click Open.
- Select Copy projects into workspace and click Finish.
- Mark Google Play services as a library: Right-click the google-play-services_lib project, and choose Properties > Android. Tick the Is Library option.
Import the sample project:
- Select File > New > Other > Android Sample Project and click Next.
- Select the latest version of the Android SDK and click Next.
- Scroll down the list of samples and select Maps [Google Play Services]. Click Finish.
Set up dependencies and run the demo app:
- Reference the Google Play services library as a dependency for the demo app: Right-click the Maps project and choose Properties > Android. Check that the library section contains a reference to the google-play-services_lib project. If it does not, follow the steps in Referencing a Library Project.
- Add your own Google Maps Android API key. The package name for
the demo app is
com.example.mapdemo. Note that the demo app already includes an API key in its manifest file. You will need to replace the key with your own API key.
- If you haven't already done so, enable developer mode on the Android device. Then attach the Android device to your computer. Note that you cannot use the emulator for running Google Maps Android API v2.
- Select the Maps project, and choose Run > Run to run the demo app.
Run the app to see a list of available demos that you can run on your own device: