You are here

How to Use Google Places API to Make Location Aware Apps

Location services have historically relied on latitude and longitude values that made it difficult for developers to provide engaging location information. The Google Places API has changed that by giving developers access to information from Google that can be extended to users in the form of place names, rather than coordinates.

This could be used in a simple application to provide users with detailed information about the place they are in, such as a restaurant, museum, or shopping mall, with other places of interest nearby. Calling the ready-to-use Place Picker widget displays a list of nearby places; selecting one results in retrieving the Place Object. Place Objects hold details about that place, such as unique Place ID, contact details, and user reviews.

Backed by Google’s database of over 100 million places around the world, this API provides a comprehensive and engaging experience for your users, and this tutorial by Paul Trebilcox-Ruiz on Tuts+ shows developers how to incorporate the Places API into their Android application to make it location aware and improve the user experience.

Once developers have created a public Google API key, they are instructed through opening a project in Android Studio and adding the required permissions in AndroidManifest.xml. Including the Place Picker widget allows the app to display a map of the user’s surrounding area, with the Place Object selected by the user allowing extraction of the relevant place data to display to the user.

Developers are then guided through finding the user’s current place and adding the complex autocomplete function for predicting location names while typing before ending on finding a place by its unique Place ID. Links to more in-depth instructions that are beyond the scope of this tutorial are provided, as is all the relevant code to help developers provide their users with engaging, contextual location information.

Original Article

Google Play Services: Using the Places API

Martin W Brennan Martin W Brennan is a co-founder of ViewPop, the social network that puts the creation of 3D photos and videos in the hands of anyone with a smartphone. For his day job, Martin is a copywriting consultant at We Write Words, learning about the world as he writes about it.
 

Comments