LocationClient vs LocationManager

前端 未结 4 1861
感情败类
感情败类 2020-12-09 02:27

What is the difference between LocationClient and LocationManager.

What is the pros and cons between them (like battery, accuracy)?

4条回答
  •  孤城傲影
    2020-12-09 02:54

    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

提交回复
热议问题