-1

For using FusedLocationApi what is the minimum version of the play services installed on the device?

Also as LocationManager does not need play services, is there any minimum requirement for using LocationManager.

I want to get the Location of users using any API that covers as much devices as possible, that why I am concerned about the minimum requirement for both of them.

Thanks.

Sudhanshu Gaur
  • 7,486
  • 9
  • 47
  • 94

2 Answers2

0

you don't really need FusedLocationApi. You can use plain Android API android.location.LocationManager instead, I am not sure it work 100% but you can try following with some customizations:

//start updates
HandlerThread thread = new HandlerThread("location updates thread");
thread.start();
LocationManager mgr = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
Looper looper = handlerThread.getLooper();
String provider = LocationManager.GPS_PROVIDER;//either gps, network, passive, fused
mgr.requestLocationUpdates(provider,1,1,callback,looper);
...
//stop updates
mgr.removeUpdates(callback);
thread.quit();

also make sure to request for location permissions before starting location updates

Lukas
  • 1,216
  • 12
  • 25
0

I want to get the Location of users using any API that covers as much devices as possible, that why I am concerned about the minimum requirement for both of them.

You could start attempting to receive location via FusedLocationProviderClient if the device supports google play services. The api has methods that returns availability of itself.

In the case of not supporting, the LocationManager could be used safely on all versions. You can request location for network or gps providers as much as the device is able to use them.

blackkara
  • 4,900
  • 4
  • 28
  • 58