Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an alternative to Location Client (Google Play API)?

I work on an app that uses location data, and it needs to work in China. Android devices sold here largely don't have Google Play API installed at all and the only way is to root the phone to install it. So I'm stuck with LocationManager which works far worse than LocationClient (part of Google Play API).

My issue is that LocationManager, when reading from GPS_PROVIDER, frequently cannot connect to enough satellites (in China) and there's occasional significant time gap between fixes. When reading from NETWORK_PROVIDER, I can get more frequent fixes, however accuracy ranges from 30 to 500. Nowhere near LocationClient API quality.

The app is supposed to monitor your movement through streets frequently, eg. update every second (high battery use, not a problem to my client) and do something when you reach certain locations.

If I use Google Play API and LocationClient, it's really working well. But that's only on Nexus4 or some non-Chinese Android device.

I'm asking if anyone know a library that can give better results than straight forward use of LocationManager, or a solution how to use LocationManager to improve results?

like image 718
Siniša Avatar asked Apr 04 '14 11:04

Siniša


People also ask

Which API is used for continuously obtain the device location?

Using the fused location provider API, your app can request the last known location of the user's device.

What is android location API?

The Google Location Services API, part of Google Play services, is the preferred way to add location-awareness to your app. It offers a simpler API, higher accuracy, low-power geofencing, and more. If you are currently using the android.

Is fused location provider free?

No Google doesn't charge you anything for using FusedLocationProvider . It is free of cost. If you just want to get GPS location, it is free.

What is Google location manager?

You can use location-based services such as getting better local search results, like commute predictions and nearby restaurants based on your phone's location, when you turn location on in settings.


1 Answers

GPS isn't working well likely due to lack of required GPS metadata (ephemeris and almanac data), or due to slow acquisition of this metadata. For the latter case, in most countries GPS ephemeris and almanac data is available through network sources. If not, the GPS chip has to download that from the satellites which can take 5-20 mins (the fastest time being when the initial data stream provided enough info for the GPS chip to acquire a lock). I am not familiar with the availability of this data in China through network sources, but it sounds like it is not widely available from what your are experiencing. (Keywords to google for more info: SUPL, ephemeris, alamanac).

When GPS is not available or slow to get a lock, network geolocation is the fallback, which uses wifi points and cell towers to triangulate a position. This requires an internet service for the device to send the APs + towers it sees, and the service sends back a location. Accuracy levels of 30 to 500 meters are quite good for this.

(BTW, a network geolocation position is also used to 'seed' the GPS chip to help it to get a faster lock)

Network geolocation on Android is typically provided by a google web service, but the phone can be configured to use other providers by carriers.

You can avoid using Google (Google Play or Google's network geolocation server) or the built-in network location service by trying Mozilla's free-for-use network geolocation service: https://location.services.mozilla.com/

You need to request an API key: https://location.services.mozilla.com/api For a code sample: this app both contributes data and is a client for the service: https://github.com/mozilla/MozStumbler

I doubt this will get better network geolocation accuracy for the area you are in, since you are already getting good results, but perhaps it is worth investigating.

like image 129
Garvan Keeley Avatar answered Nov 05 '22 18:11

Garvan Keeley