Skip to content Skip to sidebar Skip to footer

Android Location Client's Provdier

I am able to get location update or current location using LocationClient and LocationRequest. But how to know whether the location is obtained is using gps provider or network pro

Solution 1:

Apparently it is not possible while using LocationClient and LocationRequest as the priority shifts from the source to the requirement/need side of obtaining the location.

The provider is Fused Location Provider:

Fused location provider The Fused Location Provider intelligently manages the underlying location technology and gives you the best location according to your needs.

Source: Location APIs Android

I tried to figure this out when they first introduced these api, even if you 'get' the 'provider' from the location object, i.e. location.getProvider() , it returns :"fused" as the value and not as GPS or NETWORK.

Still if you want to deduce the source of location, not entirely accurate, but it can be related to the PRIORITY that is set with the help of LocationRequest

Example:

public static final int PRIORITY_HIGH_ACCURACY

Used with setPriority(int) to request the most accurate locations available.

This will return the finest location available.

I have observed that depending on the PRIORITY set with LocationRequest, the use of GPS is altered.

Only for PRIORITY_HIGH_ACCURACY does the app use GPS(not exclusively as its Fused Location Provider), hence for other two PRIORITY settings, it 'intelligently manages' the fused sources and provide the location with as much accuracy as possible, saving battery/power.

Please Note: When set to PRIORITY_HIGH_ACCURACY, i don't mean that the GPS should be enabled to obtain location under that condition, just that if GPS is enabled, you can visually see that it is being used under that PRIORITY and is not being used when you set a different PRIORITY.

The Fused Location Provider uses GPS, WiFi, Cell Towers, and Sensors to determine accurate location estimate.

  1. Have a look at The Google IO on Location API , it was good.

  2. Useful presentation: Android Location

  3. Blog: of 2013, but useful

Post a Comment for "Android Location Client's Provdier"