In this tutorial I’ll discuss that how to create a basic Android application which uses the Google Android Map V2. This application will run on any Android device running Android version 2.2 and later.
Install/Update Android SDK with Google Play services :
I am assuming that you already have installed Android SDK and Eclipse. Please update your SDK so that ‘Google Play services’ is installed and updated. Please find the following image for reference. (Here, in my case, it was installed but not updated, so I updated it.)
Import ‘Google Play services’ Library to workspace :
After the completion of Android SDK update import Google Play services library into your workspace using Eclipse menu File → Import → Existing Android Code Into Workspace and browse to the Google Play services library location (your Android SDK location/extras/google/google_play_services/libproject/google-play-services_lib) and select it.
Please find the following image for your reference.
Create New Android Project into the workspace :
Create a new Android project into the workspace from Eclipse menu File → New → Android Application Project. Please find the following image for your reference.
Add the Google Play services library to the project:
Add the newly imported Google Play services library into the project from File → Properties menu. Refer to the following image :
Create Google Map API Key for the application :
Now we need to create a API key for this application. For details about the procedure of creating a new API key please visit to this link.
Modify Manifest.xml file :
Modify the existing Manifest.xml file according to the following :
Modify the main layout file :
Modify the main layout xml file according to the following :
Please note that here we have used SupportMapFragment rather than using MapFragment in order to run it on Android versions prior to 3.0.
Modify the main Activity :
Now modify the main Activity file according to the following :
Please note that here the main activity extends FragmentActivity class rather than Activity.
Run the application on Android device :
That is it. Please comment, if you find anything more useful.