You can determine if any providers are available with LocationManager, but can it be done with the google play services location api?
When nothing is enabled, in fact "access to my location" is off, all the API calls (connect(), requestLocationUpdates()) succeed, but you never get an onLocationChanged().
Seems silly to have to use both LocationManager and the LocationClient.
I guess what I need is some way to know that onLocationChanged(0 will never get called.
Google Location Services API, also known as FusedLocationProviderApi, is Google's recommended way of getting a user's location. It provides the best accuracy based on our needs.
Settings > Location > Mode > Battery Saving . This mode only uses WiFi, Bluetooth or mobile data instead of GPS to determine the user location. That's why you have to check if the network provider is enabled and locationManager.
I've combed the docs and also haven't found any way to use LocationClient to detect if location services are enabled. onConnected, onDisconnected, and onConnectionFailed do not seem to be linked to whether Location Services are enabled or not.
I'm currently doing location requests using LocationClient, but using the old locationManager.isProviderEnabled(String provider)
method to detect if the Location Services are enabled. This is optimal for me, as, even if LocationClient did provide a way, it makes no distinction between GPS and Network and I'd really like to be able to request that the user enable GPS.
if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { //GPS Provider disabled return false; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With