Maps help us to search for places, buildings and streets. Google Maps is an example of that, but we can make our own Google Map and customize it and improvise it with new ideas.
This blog will help on how you can make use of Google Maps API Web Service to implement it on Android Google Maps.
Google Map Integration in Android is already built-in in Android Studio and you can implement it in just few clicks away. Google Maps and Google Places in mobile has basic functions of markers, search, geofencing and etc. So instead of sticking to the basic function of it why not integrate or add function using the Google Places Web API Service.
Before we begin, be sure to check out how we have integrated Google Maps with iOS applications in this article.
Creating a Google Maps Activity in Android Studio
Under your project files you can create a Maps Activity, with New > Google > Google Maps Activity.
After that there is a override method onMapReady() this function is called when the map is ready to be used, in this function you can add markers, lines , circles and etc.
Markers are used to identify locations in the map. But, Markers are also customizable you can create your own icon’s color, image info via the API. using GoogleMap.addMarker(markerOptions) method. You can also check this link for reference.
Circles are also a form of markers to mark a certain radius, it can also be used as a marker/indicator for geofencing. You can check this link for reference.
All of those are just some of the basic features of the Google Map. Now we can move on to the Google Places API Web Service and we will use the Nearby Search Function of the Google Places API, instead of searching through the maps we can use the Web API to search for us and we can mark it on the map with the details provided on the API. You can check this link for reference.
Here’s an example of the API Endpoint, the API endpoint returns a JSON format then you can use the data to pass it on your Google Maps Activity and mark it on the map instead of searching it manually, for Example, searching for nearby ATM Machine.
These are the results from the API Endpoint, then you can use these data and add markers to the Map.
Google Maps and Google Places API for Mobile has it’s limitation to just customize the Google Map App itself but you can do more if you use the Google API for Web. This blog covers the basic of it, but you can explore and experiment more of it.