Monday, June 18, 2012

[android-developers] Re: How Google Map gets current location in Android ?

Just a user here, but I can confirm the Google Maps app uses multiple location providers. I was on a train once and it couldn't get a GPS lock and just sat there forever trying to get a location. No clear view of the sky, I guess.

Then I turned off GPS location provider in the phone settings and it insisted I was in Boston when I was really near Washingington DC. That's where Google thinks the train's WiFi is, I guess. Finally I turned off WiFi and it started getting the correct location, presumably by the nearest cell phone tower.

So it uses both the GPS location provider and the network provider. I've also seen it display where I was last time I used locations before, until it loaded new data. So it either uses the last known location API as well, or caches the last used location itself.

It's pretty much a given that last known location API is the fastest if it has anything, then the network provider, then the GPS location provider. So, as has been said, for quick startup you usually use locations from those sources in that order.

There's plenty of code to get you started here:
http://developer.android.com/guide/topics/location/obtaining-user-location.html

On Monday, June 18, 2012 9:12:00 PM UTC-4, Ahmad wrote:
Can someone from Google Android (map) group address the question/request ?

"How Google Map gets current location in Android ?"  Steps and code.  Is it possible ?

The question is Not how I should do it !

Thank you.



On Mon, Jun 18, 2012 at 5:34 PM, lbendlin <lutz@bendlin.us> wrote:
It's all smoke and mirror.  You need to use whatever location provider is available to give the user the illusion that there is a location fix. Only then should you switch to "best" provider, and provide the real GPS based location.


On Monday, June 18, 2012 5:32:01 PM UTC-4, Ahmad wrote:
Can someone from Google Android (map) write the steps and code used by
Google Android in this subject ?

Here  "youtube.com/watch?v=v6gqipmbcok" says it uses cell towers. But
I can see the GPS is used by Google Map too.

Here  "http://stackoverflow.com/questions/3145089/what-is-the-simplest-
and-most-robust-way-to-get-the-users-current-location-in-a/
3145655#3145655
"   a few methods have been suggested, but doesn't seem
Google Map Android uses any of them.

Google Map Android finds the location in very few seconds, while my
app takes about a minute.
Based on suggestions from Android, I find the best provider first
(which usually is GPS) and get the location thru that. But doesn't
seem this is what Google Android Map does.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment