LocationClient vs LocationManager

Coming from someone who switched over to Google Play Services a while ago, i can give you some experiences:

I have an app, about 2,5 years old, that uses location services extensively. From the outset, of course, we used the LocationManager since that's what was available on the Android platform.

We had a pretty bad experience with Location Services on Android compared to IOS. It was buggy, unreliable, and gave less precise locations than than our IOS app, plus that it drained more battery. It was a drag.

Therefor, when Google unveiled the new API in june this summer, we jumped at it. It is way better. A couple of things:

  1. It is quicker and more reliable.

  2. It is less buggy. As an example, in the old API we could sometimes get an "old" fix with a new timestamp. This never happens anymore. There's more but it would be an even more lengthy post.

  3. It definitely drains less battery. For example, when you had a map view open, the GPS ran all the time, and the GPS icon was visible. This is not the case with the new one. This made users wonder what was going on. This is nolonger as big an issue.

So, when it comes to the location output and work, everything is better. But there are some downsides:

  1. You have to have Google Play Services installed, meaning it wont work on any "non-google-approved" phone models, and in some instances you'll have to tell users they need to install it.

  2. The API itself is more complex IMO, in part due to point 1. In addition to the "regular" callbacks i.e. waiting for location fixes etc. You now have a process that takes part before you can get started where you have to check that playservices is available, and "connect" the locationclient. This is extra code and a bit more complex to grasp. More faulty conditions to take into account in the code too (if you can be bothered...)

  3. Google play services itself requires at least 2.2 so it won't work for older devices than that. We had to tell some clients they had to upgrade...

Hope this helps.


Location Manager was introduced in Android SDK and can be used as a feature of android.

Location Client is something that's part of Google Play SDK and is introduced in the recent Google IO 2013.

One can understand that since Location Client is the latest, it is more efficient in getting the location with minimal energy(battery drain) with greater accuracy.

UPDATE: LocationClient is deprecated. You have to use GoogleApiClient. An example of it can be found here.

Google Play Services Team has cleaned up their code and moved LocationClient functionality into GoogleApiClient.

Tutorial for the same is available in http://developer.android.com/training/location/retrieve-current.html

On following link you can find IO talk about this subject http://www.youtube.com/watch?v=Bte_GHuxUGc

UPDATE AGAIN

GoogleApiClient has been deprecated again, you have to use GoogleApi based APIs instead.


I have worked on a tracking app and my experience is that LocationManager is better than LocationClient. LocationClient does not provide any way to specify that you want location updates from GPS only. All it allows is to specify "high accuracy". This works for most part but every now and then you get a location update which is hundreds of meters off BUT with a specified accuracy of a few meters. There is no way to know you got an unusable sample. With LocationManager if you specify GPS_PROVIDER you can be assured that you are never going to get wildly inaccurate samples. Working well for us.


I have been developing a location based application in android and I seriously NOT recommend using the LOCATION CLIENT in any case. Reasons :

  1. The location update behavior is very abnormal and wont work as you expect. i.e. The location updates get stuck when switching networks. (It keeps giving you some old location)

  2. The location client wont work on modified android versions of the android OS, as it requires Google play services.

With my experience, Location Client might be good on the battery of the phone but it won't be good with giving you timely accurate location updates.

I recommend good old Location Manager as I don't find location client reliable at all.

P.S. : There is no point of saving battery if you are not even getting your current location in a location based application.

EDIT: If you know the implementation of LocationManager and LocationClient (both are available in documentation), you can create your own LocationClient-like wrapper (with callbacks and stuff), which will be working on LocationManager but with custom tweakable properties.

EDIT 2:

Please find the LocationManager Wrapper class here, which provides timely location updates:

https://github.com/rahulsh12/LocationManagerWrapper