Setting Up Google Play Services

To get your location using the Fused Location Provider, you need to use Google Play Services. To get those up and running, you will need to add a few standard bits of boilerplate to your app.

First, you need to add the Google Play Services library dependency. The services themselves live in the Play Store app, but the Play Services library contains all the code to interface with them.

Open up your app module’s settings (FileProject Structure). Navigate to its dependencies and add a library dependency. Type in the following dependency name: com.google.android.gms:play-services-location:10.0.1. (As of this writing, this dependency will not show up in search results, so type carefully.) This is the ...

Get Android Programming: The Big Nerd Ranch Guide, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.