Loading...

Google Maps Android API Getting Started Tutorial : Part 1

In many cases, you may need to display a google map in your android application or may need to work with location and many more. Google map android API allows you to display a google map in your android application. Google map android API made us very easy to work with location based apps and to display google map in the application. You can also customize Google map according to your need. In this tutorial, you will learn to setup google map and display simple google map without any customization in your android application using Google Map Android API V2.

If you have already worked with map API V1 then implementing V2 is very easy. If you have not worked with google map android API then follow the following steps it’s easy.

Related:

Android Example: How to Implement Android Google Map API in Android


Before starting to develop google map android application you need to download google play services from your development environment SDK manager because google map V2 API is a part of Google Play Services SDK. To download google play services sdk, open SDK Manager from android studio or eclipse and select Google Play Services and then click download and install button if you have not installed before.


Android Example: How to Implement Android Google Map API in Android

Create a new Android Project

Let’s start by creating new android project using android studio (you can use any development environment like eclipse) to implement google map API in android with following information and choose Google Maps Activity while choosing activity.

Application Name: Google Maps Android API
Company Domain: viralandroid.com
Package Name: com.viralandroid.googlemapsandroidapi
Minimum SDK: API 17 Android 4.2 Jelly Bean
Activity: Google Maps Activity

Create and Insert Google Maps Key

After creating new android project with Google Maps Activity, you need to provide your google map android app key. For that you need to follow the instruction in the page google_maps_api.xml which is available inside res/values. Copy and paste the link in browser address bar which is available. The link will look like this:

https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=A1:9A:76:F7:94:6F:F9:50:FD:47:24:94:27:71:48:6A:99:4D:6D:4B%3Bcom.viralandroid.googlemapsandroidapi

After opening the link that is in the instruction, click Go to Credentials button and click on Create button. You will see the API key, just copy that API key and replace YOUR_KEY_HERE in google_maps_api.xml file. This file will look like below.

res/values/google_maps_api.xml


Demo Video:

Now run your Google Maps Android API Getting Started Tutorial application, Google map will appear in the screen which will look like above screenshot and demo video.

Content of activity_maps.xml file will look like below.

res/layout/activity_maps.xml

Java code of MapsActivity.java file will look like below.

src/MapsActivity.java

And AndroidManifest.xml file will look like below.

Next: Get Current Location - Google Maps Android API Tutorial: Part 2

Download Complete Project

You can download complete example project source code form GitHub.
Tutorial 2864762336418241084
Home item