• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

GPS Accuracy

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, all. I am developing an application for Android that gets the latitude and longitude of where the person is standing at a certain point in time.
I wrote a test application. When I run the application, it appears to work fine, except the accuracy prints out 300 meters sometimes.

I go into Google Maps application and it has me within a few meters of my location on the map...It's pretty accuracte.
So my questions is, how is Google's coordinates so accurate when my application reports the reading being off by 300 meters?
Does Google massage the data some how to make it more accurate? Am I missing something in my code?

I need these readings to as accurate as possible. I also print the provider to the screen and it displays gps, so I believe I am not using the network (cell towers).

Here is how I am doing it.

First, I create a LocationManager : LocationManager lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);

Then I get the provider using a Criteria Object:

Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setPowerRequirement(Criteria.NO_REQUIREMENT);
String bestProvider = lm.getBestProvider(criteria, true);

Once I have the provider, I create my own location listener:

locationListener = new MyLocationListener();

private class MyLocationListener implements LocationListener {

public void onLocationChanged(Location loc) {
if (loc != null) {
Toast.makeText(getBaseContext(),
"Lat: " + loc.getLatitude() +
"\nLng: " + loc.getLongitude()+
"\nProvider: "+loc.getProvider()+
"\nAccuracy: "+loc.getAccuracy(),
Toast.LENGTH_SHORT).show();
}
}
....
}

Then I make a request for location updates:
lm.requestLocationUpdates(provider, 0, 0, locationListener, getMainLooper());




Any suggestions?

Thanks,

Chris
 
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible google maps is detecting your position using wifi and not your GPS?

 
Chris Mack
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I turned WiFi off because I know that Google Maps can use SkyHook via the WiFi. I think I would also have to be logged onto a network in order for it to use SkyHook via WiFi. I still have the same issue with WiFI turned off.

Thanks for your reply.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not certain how closely Android's GPS feature matches the JSR GPS spec, but the JSR version of GPS allows the client to select from multiple location service providers. And, by the way, it is Location Services, not GPS. GPS is a particular kind of location service.

The distinction is important, because with cell phones, one of the more popular location services is Trilateration. Which is a means of detecting position by triangulation one's position relative to cell phone towers. On the Sprint network at least, trilateration's accuracy is only guaranteed to - wait for it - 300 meters.

Why use trilateration instead of GPS? Some (mostly older devices) didn't have GPS hardware. Sprint and Verizon often disable the GPS hardware to prolong battery life. And sometimes, you just can't collect enough satellites to use GPS, especially indoors.

Obviously, trilateration has its own limits. If you're out of range of cell service, it won't work at all, although in crowded areas, it may actually be much more precise than 300 meters. It's just one of the options.

If I remember correctly, the Androd location services allow selecting for more/loss accurate location services, so if to-the-centimeter accuracy is critical, be sure you request the fine-grained location service. How fine the actual resolution will be can vary, but the most accurate source available will be used.

Oh yes, and you may have to explicitly select for true GPS on your phone. I think it's turned off by default on mine. As I said, GPS can suck down some power.
 
Chris Mack
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your reply. I found that when I turned on the phone and started my app. when indoors and then walked outside, the accuracy stayed at about 300 meters. When I went outside and then opened my app., the accuracy got better, down to 3 meters. I didn't think that being inside would make such a difference. I expected some variation, just not that much.

Your response was educational as well. I knew about triangulation but I did not know about trilateration.

Thanks again.

Chris
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had recently developed a Android GPS tracking program on the same lines as you did.

I am using Android Samung phone and when I turned on GPS along with Network, it seems to consider the network settings first over the GPS.

Network setttings will showed inaccurate position of about 100-150 meters.

When I disabled the network settings and kept the GPS on, it gave me the correct position.

Also GPS settings work accurately outside the house or in open sky area.

Thanks,
Tushar
Oracle SOA Architect Certified Expert.
Oracle Certified Master, Java EE 5 Enterprise Architect certification
IBM Certified Rational Software Architect.
IBM Certified Service Oriented Architecture (SOA) - Associate.
IBM Websphere MQ 6.0 Certified - System Adminstrator
Sun Certified Web Component Developer for J2EE 5.0.
Sun Certified Java Programmer SE 5.0.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic