[MUSIC PLAYING]
Are you interested in making your app smarter?
Understanding your user's location
is one of the key ingredients that can help
unlock a simpler and more intuitive user experience.
I'm James McGill, and I'm going to show you
how you can use the Google Places API for Android
to intelligently adapt your app's behavior based
on the user's current location.
For some time, developers have been
able to use the Location Services on Android
to better understand where their users are.
However, our users and these APIs
have been talking in two different languages.
Location APIs communicate using latitude and longitude.
But when you and I talk about where to meet,
we use the name of a particular cafe or restaurant, not
long numbers.
The Google Places API for Android
provides the missing key needed to translate between these two
languages and powered by Google's database of over 100
million places.
So that you can turn this into this.
Let's imagine that we're building an application
to improve our users' well-being by providing fitness tips no
matter where they are.
When a user opens the app, we want
to show the information that is most useful to them
at that time, and at that particular place.
We could ask them where they are,
but who needs another tap getting
in the way of using our app?
Using the Google Places API Get Current Place method
we can skip that prompt, and automatically
determine which place the user is at.
Get Current Place returns a list of places
based on the device's current location
and ordered by likelihood.
While similar functionality has been available via the Web
Places API for some time, we have significantly
improved both accuracy and precision
in bringing the API to Android.
We've achieved this by deeply integrating the API
with the wide variety of sensors available
on a modern mobile device, including Wi-Fi and Bluetooth.
By combining the list of likely places
with context from the app, we can improve these estimates
even further.
In our case, we can use the place type associated
with each entry to filter down to only fitness venues,
like parks and gyms.
Along with each place, they Get Current Place method also
returns a likelihood.
That's a value between zero and one
representing how likely it is that the device is
at a particular place.
We can use this value as a threshold in our app
to ensure that we only infer the location when it really
makes sense.
For our fitness app, a likelihood of more than 0.7
for a place that is identified as being either a gym or a park
is a very strong signal, which we
can use to avoid having to ask the user where they are.
Awesome.
The Google APIs team is invested in improving the accuracy
of these place detection APIs.
So over time, you should expect to see
the likelihood of the first place returned increase.
If you want to help us get there faster,
you can by calling the Report Device at Place method
in cases where you have a strong signal
that the user is at a particular location.
Once submitted, this data is used anonymously to improve
our model of the world, but cannot be retrieved
by your application or end users.
So if it's important to have access to this data,
you should also store in a persistent data store.
The best part is that this functionality
is available for free up to a default
limit of 150,000 queries per day for verified developers.
Need more?
No worries.
Get in touch with us at this URL,
or check out this site for instructions
on how to verify your development project.
With the Google Places API, you can
bring the intelligence of semantic location to your app.
To get started, check out the Getting Started
Guide at this URL.
I'm James McGill, and I can't wait
to see you going places with the Google Places API for Android.
[MUSIC PLAYING]