I implemented the new LocationClient into my app, but doing a test run I noticed the readings are incorrect.
I was driving outside without GPS. WLAN on. Thus location accuracy can only be what used to be NETWORK.
I set the LocationClient to LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY; and update interval to 15 sec.
When I get the data I evaluate the Location with getAccuracy() and getTime(). Both values can not be trusted.
I get an accuracy of 25 to 50m, sometimes up to 100 meters, typical for WIFI locations. However, once I left home, the location reported (with getAccuray() < 100) had nothing much to do with my current location (actual accuracy >800m). It resembled best the cell tower location. Location was never updated in the hour I was traveling, thus always pointing to the same cell tower (incidently I always was in that area although traveling about 3 km).
Doing further tests I noticed that location and accuracy did not change for at least a minute after I turned wifi off. I was walking, so accelerator should be triggered. Again, location was way off to where I was, but accuracy still reported < 30m. After about 1-2 Minutes, the location was then reported with accuracy >800 m which was correct.
I can live with bad accuracy, but I need to know that.
Time is always updated to latest time also while the actual reading is older. This also seems a bug, someone already raised an issue at google for that.
Summarized it means I can not use that functionality. I get old readings reported as current and accuracy which does not match the reading.
Test where done on a Nexus 4. Phone was connected to an UMTS (3G) cell.
Are these known issues? Is there a way to work around it (getting the correct accuracy), or do I have to use the "old" LocationManager?
Related
I am working on gps tracking apps in android. Here is my code architecture:
BackgroundSyncService : A service class that is used for getting location update. Here GoogleApiClient is initialized and implements others Location related methods.
AppRunCheckerReceiver : A BroadcastReceiver class that will check if my BackgroundSyncService is running or not in a time interval. If it stopped then it start.
GpsEnableReceiver : A BroadcastReceiver it will fire if gps status changed. It will check if my BackgroundSyncService is running or not in a time interval. If it stopped then it start.
InternetConnectionStateReceiver : A BroadcastReceiver it will fire when internet status changed. It will check if my BackgroundSyncService is running or not in a time interval. If it is stopped, then it start.
In my BackgroundSyncService service I initialize the GoogleApiClient using this way:
public void setLocationLocationRequest() {
try {
googleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this)
.addOnConnectionFailedListener(this).addApi(com.google.android.gms.location.LocationServices.API).build();
locationRequest = new LocationRequest();
locationRequest.setInterval(3000);
locationRequest.setFastestInterval(3000);
locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
googleApiClient.connect();
} catch (Exception e) {
}
Here accuricy is LocationRequest.PRIORITY_HIGH_ACCURACY and interval is
locationRequest.setInterval(3000)
here is the GoogleApiClient implementation code.
This application GPS info section contains Latitude longitude and Accuracy parameter
My Findings: in onLocationChanged(Location location) method I check the accuracy of Location object in this way : location.getAccuracy(). Here if accuracy is less than 50 meter, then I accept it.
In 85% of the cases it working like a charm. It sending me exact location from GPS. But in 15% cases, it sending me inaccurate location like more >300 meter.
The 15% device are low cost China brand mobile.
My Questions:
How can i make accuracy level near 99%. Is there any problem on my code architecture?
Does GPS accuracy depends on device configuration? if YES then what can I do for low configuration device?
How Uber, Go-JEK etc. ride sharing apps works for all device? Is they have extra coding for GPS only?
My application is for Bangladesh. Here internet is slow. Is it has negative impact on GPS accuracy?
Thanks in advance for this thread. And also sorry for bad english.
How can i make accuracy level near 99%. Is there any problem on my code architecture?
This is real life scenario. You cannot ensure that all the location providers will work as expected. You should ask for best available position.
a) Does GPS accuracy depends on device configuration?
YES. Some devices may have older GPS chipsets which can only track GPS signals (USA) since there are other positioning systems like Galileo (Europe), GLONASS (Russia), QZSS (Japan) and Beidou (China). The more the chipset support for these types the more chance you get to track more satellite hereby position fix. Also TTFF (time to first fix) depends on how many channels do the gps receiver has.
b) If YES then what can i do for low configuration device?
Since this is a hardware issue, you cannot do anything here. But other location sources can compensate the lack of GPS data such as AGPS (aided gps), wifi and cellular positioning. Also there are some paid options which provides a database to locate your device using wifi access points and cellids (they claim that they provide best solution on wifi but i m not sure as I dont use it. you can check it out http://combain.com). Wifi and cellid also depends on how many wifi access point and cell tower available around and how far they are (signal strength). If you need 50m accuracy, cellular positioning has nothing to do but wifi has a chance to get closer to this value.
Some study results from 2009 [3]
3G iPhone w/ A-GPS ~ 8 meters
3G iPhone w/ wifi ~ 74 meters
3G iPhone w/ Cellular positioning ~ 600 meters
How Uber, Go-JEK etc. ride sharing apps works for all device? Is they have extra coding for GPS only?
They may have specific Location strategies but it will based on using other sources during GPS outage.
My application is for Bangladesh. Here internet is slow. Is it has negative impact on GPS accuracy?
Other answers claims that internet is not related to GPS. Yes it is true it is not related to GPS but location. AGPS uses internet to fetch 3 types of data (Satellite signals, almanac and ephemeris) which assist GPS to provide position fix faster. If ephemeris and almanac are outdated or the device moved several hundred km from the previous position fix then it is called cold start and takes around 12-15min without AGPS.
Fused location provider already knows how to provide best solution with these configurations, so you should bless it.
References:
[1] http://gpssystems.net/agps/
[2] http://gpsinformation.net/main/almanac.txt
[3]
https://communityhealthmaps.nlm.nih.gov/2014/07/07/how-accurate-is-the-gps-on-my-smart-phone-part-2/
First, (and second)
How can I make accuracy level near 99%. Is there any problem on my code architecture?
Does GPS accuracy depends on device configuration? If YES then what can I do for low configuration device?
Both - device configuration and code architecture, are important here. If you are already at an 85% success rate, the code architecture is alright I think.
As far as GPS goes, line-of-sight is an important factor when it comes to device configurations and accuracy.
Although a low cost mobile could return an accurate location with a clear line-of-sight. You can try running 2 cycles more/waiting to attain higher accuracy.
In a worst case scenario and for what its worth, you can also try retrieving location using the LocationManager and GPS provider technique which works as a fallback in the 15% just to compare and ensure you are using the most accurate location you can get.
Location Strategies put it as
In most cases, you'll get better battery performance, as well as more
appropriate accuracy, by using the Location Services API.
How Uber, Go-JEK etc. ride sharing apps works for all device? Is they have extra coding for GPS only?
They do work but not always with highest of accuracy for locations received within the app. If there are any location hacks for us developers, we need to find them, maybe a 5th page google search result :) or benefit from the open source environment. For me, best practices and android repo links suffice. You have already followed posts like Receive location updates
My application is for Bangladesh. Here Internet is slow. Is it has negative impact on GPS accuracy?
No relation between Internet and LocationManager + GPS_PROVIDER
I am looking to get device's location every 1 minute. I noticed the incorrect location of some devices.
With S7500 the correct location is found after 3-4 minutes sometimes or more, with HUAWEI Y530-U00 the correct location if found instantly. I used the example https://github.com/googlesamples/android-play-location/tree/master/LocationUpdates.
S7500 is not very powerful so I thought about a device limitation but it find location after a while. Maybe the code use only phone cell or internet instead of GPS and it makes location difficult.
Is there a way to improve this?
Hi i am working on a real time location tracking application where i have used Fused Location provider Api. I was able to get the location updates when the device is moving. But i was also able to get the location updates even if the device is stationary on a table when i am indoor. So I have calculated the distance between the last location and the current location triggered in Onlocationchanged event and checked whether the distance is less than 30 metres, to know the device is actually moving. But sometimes the distance i get is greater than 400 metres (indoor/Device is Stationary). How Can i ignore the onlocationchange event when i am indoor? Any suggestions are appreciated.Thanks in advance.
Unfortunately I don't believe there's much you can do about it.
The reason you see those updates with great changes it's because indoors, you won't get a GPS lock, so the device is relying on cell tower and WiFi hotspot triangulation to determine your location, and something around 200m to 1km is the best you'll get with this kind of technology.
A possible attempt to hack-around it would be to:
check the source and precision of the location update
use the activity recognition API to guess if the device really moved
but both are a hack, around the technology limitation and might not be as reliable.
How would I verify/ track device location within a 5' accuracy? I've heard of people using cell towers/ gps combinations.
As far as I know, the only way to get a 5 feet accuracy figure is to use GPS, then it still isn't always that accurate depending on how good a fix of the satellites (clear view to the sky) you have.
Cell tower / Wifi triangulation methods only serve to speed up positioning and will seldom (if ever) be more accurate than satellite positioning methods.
GPS is the way to go. Cell towers won't cut it. In Android (and I believe iOS) the system will provide you with an accuracy reading in addition to the actual location. You could use this value to determine whether the value you've received should be uploaded to your server. Keep in mind using the GPS is very battery intensive and there's no guarantee of how good the accuracy will be. Depending on conditions you may not be able to achieve 5' precision.
As #CommonsWare points out, 5' is really unrealistic anyway although you can get close.
As CommonsWare says you will not get much better that 10 metters accuracy in a consummer-grade device. Even in open sky, the atmosphere characteristcs change minute by minute and thats enough to change the GPS readings.
However, it's teoreticaly possible to increase accuracy if you could get all of the following:
1-There are some stationary GPS receiver stations with fixed known locations which measure the current GPS signals deviation. You would need to have one of those close to you and have access to the data in real time.
2-You would need to have low level access to your phone GPS receiver to read the unprocessed data received from sattelites. This would be different from device to device, and as far as I know, no supplier is providing this access.
3-Finnaly, you would need to do all the calculations required to determine your location applying the deviations got from point 1 above.
good luck.
The only way you can get this type of accuracy is with WAAS. As far as I know, there are no Android handsets that can receive WAAS corrections. If this is for a specific controlled situation, you could use a bluetooth gps receiver with WAAS, and only in WAAS supported locations. However, if this was for a wider deployment, then I think you are out of luck.
I am using LocationManager to get the values of Latitude and Longitude of a user. These values are updated regularly to a database and find out the distance between two users basing on the stored Latitude and Longitude values.
Now,onLocationchanged() called very slow,some times get fast.while i'm waiting long time to proceed next process.When i 'm in indoor the Location search is very slow..
Is there any solution to this prob.pls give me a guide and example.
Please Accept My question as soon as give me a solution.
If you use network location provider, you will get location faster, but it will be less accurate (100-500m).
OTOH, GPS provider will be more accurate (10-20m) but it will take more time to acquire location as device needs to acquire GPS satellite signals. Sometimes it's not even possible to acquire signals, especially if indoor or beneath thick trees.
Well there are there types of GPS starts :
COLD start: takes a lot of time. The old GPS (satellite/time) data is practically useless.
WARM start : is when the GPS device remembers its last calculated position, almanac used, and UTC Time, but not which satellites were in view. You get the fix fairly fast.
HOT start : is when the GPS device remembers its last calculated position and the satellites in view, the almanac used (information about all the satellites in the constellation), the UTC Time and makes an attempt to lock onto the same satellites and calculate a new position based upon the previous information.
To emulate the warm start case all you have to do is connect to the SUPL network, which provides assistance data. Even cold starts can be converted to a warm start. To make sure that SUPL networks are available, make sure you are connected to the internet. In indoor cases no satellites are visible so getting an exact fix is tough without any assistance data. At least 3 satellites should be visible. Again SUPL networks come to the rescue.
Note that, various GPS chipset have different performances/algorithms and the triangulation time depends on the SUPL networks provided by your Network provider.
You can here more about this here
Good starting point is blog/project by Reto Meier:
http://code.google.com/p/android-protips-location/