2

Here Google says:

The Google Play services location APIs are preferred over the Android framework location APIs (android.location) as a way of adding location awareness to your app. If you are currently using the Android framework location APIs, you are strongly encouraged to switch to the Google Play services location APIs as soon as possible.

Can anyone explain to me why(if I) need to switch to the new APIs?

Alexander Suraphel
  • 10,103
  • 10
  • 55
  • 90
  • One of the reason to switch is Google Play services location APIs are more battery efficient than Android framework location APIs. – Chintan Soni Feb 23 '16 at 08:21
  • @ChintanSoni I see but is there some compelling reason not to? I'm trying to decide and I don't want to change back for some reason. – Alexander Suraphel Feb 23 '16 at 08:23
  • 2
    A reason not to? If you use the FusedLocationPrividerApi then you will need to prompt the user to upgrade Google Play Services if needed. If the user doesn't have the version required by your app, and chooses not to upgrade, your app won't be able to get any location info. – Daniel Nugent Feb 23 '16 at 08:34

1 Answers1

6

I think that the core difference is that FusedLocationProvider use the both physical sensor and google play service, where as other (location manger /location listner) use physical senors like gps and network.

FusedLocationProvider

FusedLocationProvider uses a combination of hardware and google play service, to found the context(location) of the request.

Pros:

  1. It provides better accuracy with less battery drain, as it switches between gps and WiFi based location.

  2. optimized transparently to you.Avoid heavy processing by using cache of location.if user has many location aware apps than it will not waste time and resources for waiting to get new location and use the previous location.

  3. Google Play Services 3.2 includes several enhancements to the Location Based Services. The Fused Location Provider now supports the selection of a low-power mode option when requesting location updates, and the ability to inject mock locations — allowing you to more efficiently test your apps in a variety of simulated conditions.blog

  4. When desiring to save battery power, and using coarse updates, the FLP doesn’t use Global Positioning Services (GPS), and instead uses WiFi and Cell tower signals.

  5. Fused API provides 3 location providers.

HIGH_ACCURACY mode use all location providers

BALANCED_POWER mode exclude gps

NO_POWER mode use location from other apps

Cons

  1. Location manger , use gps although it takes battery yet its work great without network.
  2. Indoor accuracy is still a question mark , as if your using apps in indoor its accuracy is not good.
  3. location manager is slow but accurate with gps , its a trade-off between accuracy and battery consumption.

  4. If you plan to release it on Amazon, F-Droid or anything other then the Play Store, use the LocationListener or implement both. There are quite a few people who don't want Google to track their every move

To me the more accurate is Location Manager as it use in all platforms no need of google play store. but it takes some time and location detection speed depends on some factors such as you are on open place or not , weather etc

Related Material

Community
  • 1
  • 1
Fasiha
  • 488
  • 3
  • 11
  • Fashia, great answer. Do you think it's a good idea to use the `FusedLocationProvider` on devices that you know will be connected to the internet only sparingly. People who live in rural areas, for example. – Alexander Suraphel Feb 24 '16 at 08:43
  • i must suggest to use a combination of fused and android sensor location. because if app will not full fill the promise than user uninstall it, with out asking for the reason. – Fasiha Feb 25 '16 at 05:03
  • If you don't specify a provider to use (e.g. just a Criteria with high accuracy) then the LocationManager can return locations with provider "fused". This isn't one of the provider constants in LocationManager... – Crag Feb 15 '17 at 17:41