Android Google Maps Tutorial with Example

By | August 4, 2019
Android Google Maps Tutorial Example

What is Google Maps API In Android ?

Android Provides to Integrate Google Maps API in your application. Google map displays your current location, navigate location direction, search location etc. You can also customize Google map according to our requirement.

Google Maps API automatically handles the access Google Maps servers, data downloading, map display, and response to map gestures.



Google Maps API you can use to add markers, polygons, show location and provide features to interact user with the map.

You can use Google Maps API On your Application so you must add Google Play Service Library in Your Application.

It is show any location on the map And show different routes on the map.



What is Google API in Android ?

Google provides in google map api in V2 use.It’s better than Google Maps Api V2 instead of V1, because no new features will be added to Google Maps Android API v1.

How to Integrate Google Maps In Android ?

First of All You Must Register API in Google Console And then Integrate API On Your Application.

Second Of You can Integrate Google Play Service Library On your Application.

Third On You can Implements Some Method On Your Application.This Method is worked after the google Play Service library add on your application and then Display the Methods to work on Your Application.



Types of Google Maps in Android

Normal : In this Type of map displays typical road map, natural features like river and some features build by humans.

Hybrid : In this Type of map displays satellite photograph data with typical road maps. It also displays road and feature labels.

Satellite : In this type of Map displays satellite photograph data, but doesn’t display road and feature labels.

Terrain : In this type of Map displays photographic data. This includes colors, contour lines and labels and perspective shading.

None : In this type of Map displays an empty grid with no tiles loaded.



Syntax Of Types of Maps Uses in Android

googleMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
googleMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);

How to Get Google Maps API in Android ?

First Step to Click this Link https://console.cloud.google.com/ And Login Your Gmail Account.

Second Step to Open Dashboard on Left Side Navigation bar to Select APIs & Libraries to Select and Open the Next Screen to Display Enables API And Services.

How to Enable Google Maps Api in Android

Third Step to Select Google Maps SDK in Android.

Enable Google Maps Api SDK in Android

Click Enable Button in Google Maps SDK.



Google Maps Enable API in Android

Click Top Button on Select Project And Open Popup Box To Top Right Create New Project.

How to Get Google Maps API in Android
Getting Started Google Maps SDK Integration in Android

Fourth Step to Created Project To Select Same Top Center Box Open Select A Project And Selected Project You Want To Created.

 Now Go To Credentials Tab And Create Credentials Open Menu To Select ApiKey And Open Key PopupBox To Copy And Click To RESTRICT Key..Now Open Screen To Add Your Package Name And SHA Key And Select Android Apps And Click To Save Button.

API In Android
Google API In Android



Getting Google API In Android Tutorial Example

Now Above All Steps to Get the Google Maps SDK in Android And then Register your project on Google Console. Now Integrate SDK in Android.

Example of Google Maps SDK Integration in Android

Create/Select  GoogleMapsActivity In Android.

How to Create Google Maps Activity in Android

Add Dependency in App Module build.gradle File

Declared Permission And Add The Google Maps API Key in AndroidManifest.xml File.

Create activity_maps.xml File

Create MapsActivity.java File Follow this Code.

Above The All Steps And Example To Create Google Maps In Android. You can run this Example to Display Maps On Your Device.