How can I read the GPS sensor data more frequently? - android

Even if I set requestLocationUpdates to 0 seconds and 0 meters, the GPS sensor data updates only about every second. I need the satellites SNR data more fequently; 10/s would be nice. Is there any possibility?

If you have direct access to the GPS chip, you can set the message interval for each message. On a smartphone you cannot set that message interval.
However for consumer GPS devices the maxmimum GPS message frequency is either 1/s or 2 messages per second.
So probably, as long as you don't use an specialized GPS chip with e.g 10/s msg frequency,
it does not make much sense, to raise from 1/s to 2/s.

No, the update frequency of the device is limited by the GPS hardware itself, usually to about 1hz. Android hardware seems to be mostly concerned with battery life being one reason. Also, most GPS hardware that produces an output frequency that is greater than 1hz is cheating somewhere in the background and interpolating points, which you can do in code if you want more points. This is because, in general, producing a higher output frequency means a sample of fewer points which means reduced accuracy. There are really no "easy" solutions around this problem. If you need more data and more accuracy you are looking at sensor fusions and and probably some sort of Bayesian filtering.

You set that when you start listening to the GPS. You pass it as a parameter.
requestLocationUpdates(Provider, TIME_INTERVAL, DISTANCE_INTERVAL, LISTENER)
TIME_INTERVAL is in milliseconds.

Related

How does Apple or Android calculate speed in devices?

There are any documentation for this? I've checked many formulas and algorithms but didn't find an explicit definition how they get the speed provided in Geolocation object.
The GPS chipset provides the current velocity to the system along with the current location.
The chipset may compute the velocity by comparing location over time and correcting for the curvature of the Earth at the current location, or from the Doppler shift of the received satellite signals.
Whichever method is used, the operating system doesn’t need to do any processing to get the speed. The velocity data is provided along with location and altitude data directly from the GPS chip (actually chips in many newer devices support both GPS and GLONASS, but which system is used is not visible to the user).
Physics.org has a simple explanation of how GPS works
Wherever you are on the planet, at least four GPS satellites are ‘visible’ at any time. Each one transmits information about its position and the current time at regular intervals. These signals, travelling at the speed of light, are intercepted by your GPS receiver, which calculates how far away each satellite is based on how long it took for the messages to arrive.
Once it has information on how far away at least three satellites are, your GPS receiver can pinpoint your location using a process called trilateration.
But you can search for more detailed explanations of the mathematics and physics involved.
It basically scans your location (i.e. your latitude and longitude) and compares with the last check. Using euclidian distance, it can get the distance in the period of time. With the time (for example, if it scans your location every 2 seconds), it can easily estimate your speed by doing Speed = Distance/2.

Why does the Android GPS-Fix vary by 200 ms?

I am writing my Master thesis atm and analyzed about 400 different GPS-Trajectories (paths consisting of a list of longitude/latitude points and an according timestamp) recorded with the MediaQ-App (probably not important) for Android (about 310 trajectories) and iOS (about 90).
When analyzing the time intervals between the timestamps, I was expecting the inaccuracies around the 1 second frequency, in which the timestamps were supposed to be recorded, since neither Android or iOs are real-Time-OS from apps point of view. Still, why are there, what appears to be local peaks in about 200ms steps? Be nice, I do not know a lot about mobile operating systems :-)
(x-axis: seconds, y-axis: the relative probability that a timestamp will be recorded at this point in time. Ignore the exact values of the y-axis...)
The usual behavior is that an App takes the timestamp direct from the location delivered by the system. Most probably this is the case in that App, otheriwse this would be a heavy programming bug. (The delay between nominal GPS time and receiving system time of about 200ms is plausible, I saw that in my app, and in ios Map app, which makes a correction in their map api to extrapolate the location into the future, to try to compensate that delay)
Under android (and ios) it is import to know whether the location are determined exclusively by GPS. On both plattforms (ios, android) an App can set whether GPS only or combined GPS + WLAN + Cell Locationing is used.
For high quality recording is is highly recomended to use GPS only.
A GPS chip once having a location usually outputs a location with a timestamp exactly at 000. Exception can happen before the location is valid.
Under ios if the location was obtained by GPS the millisecond are always 0.
I have no experience with android, but usually the GPS chip itself sets the value to millis = 0. (However, some android phones are known to use a crippled cheap GPS chips, that are not able to get an intial position without the help of an internet conection)
It is possible to determine whether the location was obtained by GPS by looking at the course (or called heading) and speed value, which are invalid for non GPS locations (cell Tower locationing)
To know whether this time variations come from the Application (not using the GPS only mode) or if it is caused by Android, you can test that with another application on the same phone. (E.g Motion-X GPS) (Or by comparing both apps on another android phone)

WiFi readings unstable in android

I am building an application that collects the RSSI levels of APs around me and do some calculations based on that.
The problem is that the readings are unstable even if the device is still. For example, signals from an access point fluctuates between -71, -68,-75 and so on....
Is there a way to stabilize the signals?
In telecommunications, received signal strength indicator (RSSI) is a measurement of the power present in a received radio signal.
I think the best you can do is count them al together and devide them after a x amount of measssure time. (since you would never get an 100% accurate acces point because of al kinds of components).
source:
http://en.wikipedia.org/wiki/Received_signal_strength_indication
"The problem is that the readings are unstable even if the device is still. For example, signals from an access point fluctuates between -71, -68,-75 and so on...."
This is the nature of the wireless signal. Even if the device is still, the environment is "moving", so, the signal is suffering from small scale fading mostly due to the environment scatterers. So, it is normal to obtain these fluctuations in the device measurements.
The accurancy of each Android device Wi-Fi measurement is another story.
Moreover, keep in mind that the values returned are in dBm which means that is in mWatt but expressed in the log scale. So, as Thealon proposed the averaging, you have to be careful because you cannot devide dBm values.
one solution would be to convert the dBm values back to mWatt and then perform the averaging. like below
Convert dBm to mWatt: mWatt = 10^(dBm/10)
When getting the RSSI, Google recommends to:
Use calculateSignalLevel(int, int) to convert this number into an absolute signal level which can be displayed to a user.
Official Docs

Device Location Verification

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.

How to find latitude and longitude faster in android?

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/

Categories

Resources