androidlocationgoogle-play-servicesandroid-locationfusedlocationproviderapi

Android: Check if Location Services Enabled using Fused Location Provider


According to the Android documentation:

The Google Location Services API, part of Google Play Services, provides a more powerful, high-level framework that automatically handles location providers, user movement, and location accuracy than the platform location API in android.location.

But using the fused location provider (from location APIs in Google Play services) I do not know how to check if the user has the location enabled or disabled.

Using the old android.location it was easy:

locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);

But I don´t want to use both Google Play Services fused location provider and old android location.

How could I check if the location is enabled by the user using the Fused Location Provider?

Thanks in advance.


Solution

  • See SettingsApi: check your location request then ensure that the device's system settings are properly configured for the app's location needs.