I have a mapview where I want to track the user's current location. GPS as well as 'use wireless networks' is activated in my phone settings.
Nevertheless, since I'm indoor I don't get a GPS fix, therefore the location is determined via network; wifi spot is available.
I have the Google Maps app running as well as my application running.
Strangely, the current location differes between Google Maps and my application, where the Google Maps is very accurate while in my app the location is somehow off a few 100 meters.
In my application I basically do the following (for debugging purposes now):
1) initially place one marker on the map: geopoint retrieved via locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
2) initially place another marker on the map: geopoint retrieved via locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
This will put the last known locations of both providers onto the map (eventually last known from outside my app).
3) then for the regular updates (since I don't get a GPS fix anyway indoor here), I do:
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, baseLocationListener);
You can see for the frequency and distance I pass the 0 param in both cases.
In the app manifest, the following permissions are granted:
android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_MOCK_LOCATION
Actually my baseLocationListener does get called, which I see in the log, but the updated location is somehow the same as the last known current position (of LocationManager.NETWORK_PROVIDER), same lat/lng.
I thought maybe I overlooked something or missed a parameter or setting, or my code has a bug. Therefore I installed some other (3 in total) LBS apps from the Android market that also show the current user's location. The current locations displayed in those apps are equals to the one in my application - and they're all some 100 meters off - but at least all the same.
See the screenshot here:
screenshot http://img33.imageshack.us/img33/8679/mapproblem.png
http://img33.imageshack.us/img33/8679/mapproblem.png
Now I am wondering:
1) as I understand, getLastKnowLocation is system-wide and not app-wide, why are there differences between the location in Google maps and all the other apps?
2) does Google Maps not update the lastKnownLocation of a provider?
3) does Google Maps use a different custom location provider (i.e. due to licensing reasons) other than GPS_PROVIDER or NETWORK_PROVIDER as they are in the SDK?
4) how do achieve the same accurate result with the NETWORK_PROVIDER like Google Maps does?
I think I found an answer, although not a solution. It seems that the problem is in the data quality of the different map provider that are used for Google Maps and MapView in SDK, which differ.
The map tiles coordinates don't seem to be very accurate, just like in the public google maps web api / tiles.
See this screenshot for an example, where I pinned the same geo point.
screenshot http://img339.imageshack.us/img339/2793/gmaps2.png
http://img339.imageshack.us/i/gmaps2.png/
The map using the public map api is off a few hundred meters.
Seems that we just have to live with it ?! :(
I know your post is one-year old, but the answer I think is that: Google map data in China is offset or distorted. I notice that you are in South China. The China government requires that for some security reasons. Here is the Google search results.
The transformation algorithm is unknown. Probably you can Google it, and wish you good luck.
The Map and Satellite images in Google Maps is off by a couple of meters, but I don't think it should be off that much. This seems to be a couple hundred meters.
Depending on how you acquired your position will dictate what position you get. From what I understand, these are the three levels of acquisition.
GPS
Network
WIFI
GPS and Network are determined by triangulation. GPS being the most accurate.
WIFI is done using a "whois", an address is acquired and then geocoded, being completely inaccurate at times.
Some phones say they are GPS, but they are most likely Pseudo-GPS like the iPhone 1.
Related
I have an app in android using GoogleMaps API.
When i use google maps, I active gps and it find me so fast.
When i use my app, it takes some seconds, and if I'm in my house, gps dont find me. WHY ?
A short summary of my code:
locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
MyLocationListener = new MyLocationListener();
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER,
7000,
5,
MyLocationListener
);
Thx for answers and sorry for my poor english
EDIT
Thx for answers ! the problem is that i dont want to use network provider. Wifi is exelent, and 3g have a 400 meters error jejeej.
I only want to know, why google maps, using GPS, find me in 1 second with perfect position Although I stay in a house.
Your answer is "use coarse locate". If google maps use network providers befor gps, its impossible he find me so fast. :(
GPS is using satelites, When you are indoor it can't get the signal from the satelites hence it can't find location (can't get a fix).
The GPS needs signals from at least 4 satelites to get a proper fix, that usually takes a few seconds, once you already have a fix you can maintaine it very easly. therfore if you are using google maps it will get you a fix faster.
To get a better understand on how GPS works, check this link
You might want to use different location approachs for getting location indoor (coarse location could be the answer). I would also consider using the fused location by Google play services, it gives you a wrap up on the location providers and get you location based on what avilable at the time (meaning GPS, coarse - wifi or network).
You should try using Coarse locates for a quick locate followed by a fine locate to have a more accurate location. The coarse locate is usually very fast, while the fine one takes more time.
Basically, the idea is to do multiple locates and overriding the less accurate ones by the newer and more accurate locates.
You can find more info on the Android dev doc: http://developer.android.com/guide/topics/location/strategies.html
EDIT: if Google Maps is able to find you so fast, it is because you are not moving and they use the knowledge of the last location. Please read the above link that gives a lot of useful information for Location strategies (and it works very well).
I'm building an app for mobile which needs to monitor the distance between the user's location and multiple location markers at regular intervals. From what I have read here and on other sites, I have three options:
1) use the distanceTo and distanceBetween functions to calculate the distance between the user's location and each location marker
2) use proximity alerts associated with each marker location
3) use geofences associated with each marker location as per Creating and Monitoring Geofences
Which approach is the best to use in light of (a) ease of implementation, (b) battery drain, and (c) gps / location accuracy? Given that I am designing predominantly for mobile, I am assuming that wifi will not always be available.
An important note on the Google Play GeoFencing API. I've found that the GeoFencing never intelligently retrieves locations from the GPS hardware. The GeoFence API will observe the most accurate location available from the OS or if no recent location reading is available, it will cause a location to be calculated from Wifi / Cellular. (which sucks because cellular is wildly inaccurate and wifi is often unavailable)
So to get at all responsive or accurate results out of the Geofencing API you have to set up your Geofences and then poll the GPS hardware on an interval, not even doing anything with the result received, so that under the surface you are providing worthwhile data to the OS.
I can't speak specifically to the behaviour of LocationManager.addProximityAlert but I doubt it behaves any differently. You could really use either and the results and performance will likely be identical because the heavy lifting is done by waking up the GPS manually.
As for how to implement your current distance to your fences, none of the proximity APIs have an interface to determine this for you. In the situation I describe above when the GPS poll occurs, instead of doing nothing with the result, I'd use it with distanceBetween to update the distance between myself and the points I've set my GeoFences at.
I'm working on a app which requires that a device with this app installed will automatically find other users within a maximum radius of 200ft (worst case scenario 300ft, but that's pushing it) and/or a minimum radius of 40ft.
Ive tried the obvious solution of using GPS and a MYSQL query that query's our location table for other users within the 200ft radius, but as you probably would guess this is not incredibly accurate and if the device uploads coordinates that are off by over 200ft the server will return a list of users that are not within proximity. While I would prefer to just get the app to work the way it was meant to I'd rather the server return no users than false positives.
I know there's probably no simple way to do it accurately, but what other options do I have? And how did Color manage to do it? With all the tech in the avg smartphone and all the location based apps this has to be possible to do.
200ft (60m) is no Problem for GPS. Usually GPS is below 10m.
You even have a location.getAccuracy() method which you should evaluate
Just use GPS as your only location source. do not use cell tower location provider, when you want accuracy < 60m.
Of course inside a building, when you are sitting at your desktop GPS will not work, or is off by 60m.
GPS needs a view to open sky not obstructed (by dense materials).
Take a look at this question:
how to get the most accurate location using GPS and AGPS with given time in android?
Basically it depends on the phone's GPS and the current environment. Besides that, there's probably nothing you can do to further boost the location accuracy other than using GPS.
So I know next to nothing about GPS and Apps, but I do want to get my feet wet and have a (simple-ish in my mind) idea for a simple app based on GPS or manual address.
I basically need to know if you can do something like this
if GPS Location is (11.111/22.222) { Show(**THIS STUFF**) }
or if manual address is (555 Main St, Salem, OR) { Show(**THIS STUFF**)}
in android or iphone
You can. It's considerably more complex than that. And there are apps for both platforms that do exactly that. A quick search of Google, Apple Store, and Android Market will tell you what the current apps for that are.
If you want to do this yourself you will need to learn some new concepts. Geofencing (geographic buffers). Geolocation (address to coordinate conversion). And read up on how to efficiently use the location services provided by the devices you are writing for.
You should use android location api for GPS Location, and check in the onLocationChanged() method : if(myLocation.getLatitude==11.111 && mylocation.getLongitude==22.222)
On manual adress You should use android maps api.
I'm trying to figure out the location services options under Android 2.3.3 on my Verizon Droid X, I have 3 options:
Google location services
Standalone GPS services
VZW location services
Enabling or disabling Google location services causes the following to return true or false respectivly.
myLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)
Enabling or disabling Standalone GPS services causes the following to return true or false respectivly.
myLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)
Enabling or disabling VZW location services seems to have no affect on the isProviderEnabled method. If this option is the only one enabled, then the isProviderEnabled method always returns false regardless if using NETWORK_PROVIDER or GPS_PROVIDER.
The way I understand this is:
Google location services = WiFi MACID location
Standalone GPS services = GPS location
VZW location services = nothing except something special to Verizon (like Navigator)
Is this assumption correct? If so, where does AGPS and CellID come into play?
"Each kind of location service is being used not only to help their applications bring you the most relavent information, but to assist the network in improvements based on your individual experience.
Google wants to know where you are to answer your questions of 'Coffee shops near my location' and various other things.
Verizon uses your path from tower to tower to tower as you travel to make someone else's (or your) trips through the same area more efficient. If while driving up a highway you are on tower A and tower B, C, and D are all coming in to range, but your phone always goes for C...in the future, tower A can just tell your phone to look for tower C rather than have it search blindly.
There's a lot more detail behind the scenes, but that's the general idea."
see reference link below for more details
http://www.droidforums.net/forum/motorola-droid-x2/159360-location-security-settings-questions.html