How to find latitude and longitude faster in android? - 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/

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.

Does Location Services' `getLastKnownLocation()` check phone's current GPS location?

Some resources say getLastKnownLocation() merely gives a location of some previous app's Location Change Listener.
But one thing I feel is missing from the conversation -- if the phone has GPS enabled, isn't this GPS tracking/updating as the phone moves? So if I call getLastKnownLocation(), isn't it getting the current GPS from the phone's constantly-updated GPS?
If so, then why do people warn against using it / accuse it of potentially getting a "stale" location? If the GPS is being tracked / updated, and getLastKnownLocation() makes a one-time grab of it's current position, what makes getLastKnownLocation() bad?
What am I mistaken about the Locations service or GPS?
The documentation says: Returns a Location indicating the data from the last known location fix obtained from the given provider.
Also, about the "out of date location": This can be done without starting the provider. Note that this location could be out-of-date, for example if the device was turned off and moved to another location. ("This" refers to getting the last known location).
Also, taken from LocationProvider docs:
Each provider has a set of criteria under which it may be used; for example, some providers require GPS hardware and visibility to a number of satellites; others require the use of the cellular radio, or access to a specific carrier's network, or to the internet. They may also have different battery consumption characteristics or monetary costs to the user.
if the phone has GPS enabled, isn't this GPS tracking/updating as the phone moves?
Well, it is, but not constantly. This has to do with battery consumption, if the phone was constantly updating the GPS location, the battery life would suffer a lot. The GPS location is usually updated when some app requests it. But even that request is not guaranteed to succeed. For example, suppose your going into a tunnel. Some application requests to update the GPS coordinates right before entering the tunnel and it succeeds. Now, you've entered the tunnel, which is 5km long. Most probably your device won't be able to get a GPS fix from the tunnel, so for the next 5km (at least) getLastKnownLocation() will return an outdated value, since the devices last known location was at the entrance of the tunnel.
What you could do is explicitly request to update the GPS location, that however might take some time and there are no guarantees that it will succeed.
You have the assumption "if the phone has GPS enabled, isn't this GPS tracking/updating as the phone moves". This assumption is incorrect. The GPS functionality takes up a lot of battery life so it should be used sparingly and almost certainly not all the time.

Can you narrow a phones location to the cm?

Id like to narrow down the location of a phone to the cm or less than a foot (nothing creepy I promise :). Say there was a room full of people I would like 1 user to be able to look though an augmented reality view on their phone to find another user.
Only problem is the location data, I know gps is probably out since I think its only accurate to 10-15 meters? Could you do something with the wifi points, ie have a couple and measure ping time between them to work out location? Or does this technology already exist? Thanks C
Android provides basically two location provider :
GPS
Network
GPS is the most accurate source which you don't want to use and it's slow.
Network location provider is false but less accurate than gps.
So the only hope is GPS.

Check if the device is STILL (Not Moving) to ignore onlocation changed events in Android

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.

Is there any idea to get altitude data quickly while using LocationClient for Android?

I have been using LocationManager for Android to record location data, and the new 'LocationClient' API has come, so I tried it.
The result looked good. It gets location data very quickly, but I found that the Android Fused Location provider(LocationClient) doesn't provide altitude data in almost all cases, even though I tracked quite a long time.
So, the question is, 'Is there any nice way or idea to get altitude data while using LocationClient?', or should I just stay using GPS provider which is not fast enough?
AFAIK, the only provider today in standard Android that can give you altitude is GPS. AFAIK, both WiFi hotspot proximity and cell tower triangulation presume that you are on the surface of the Earth, or at least within a relatively narrow band of the surface, treating the local area as a flat plane.
LocationClient and the "fused" location provider is designed to blend all of those approaches to get you more accurate latitude/longitude more quickly. However, if my AFAIKs are correct, it cannot get altitude any faster than GPS. And, depending on how it handles things internally, it may put more emphasis on the non-GPS providers, and therefore give you altitude less frequently. Since the Play Services stuff is closed-source, we have no good way to know.
or should I just stay using GPS provider which is not fast enough.
The speed of obtaining GPS fixes is tied to environment (e.g., indoors/outdoors) and to device GPS receiver quality.

Categories

Resources