drpickett:
When I say I "demand" a certain accuracy from the GPS what I mean is
that when it reports a location I call getAccuracy and if it is not
good enough I throw away the result. Maybe I should just be more
lenient on the accuracy from a network location.
All of this and people have only sort of answered my question. I
understand that the answer may just be "I don't really know what it
would do" and I understand that really isn't an answer people post on
the forum because it does not fill the information gap. The accuracy
is a function of the number of satellites in view and other stuff. I
get that. But the question remains the same. When it tells me my
location is hundreds of miles from where I actually am, will the call
to getAccuracy return hundreds of thousands of meters?
PsuedoCode for the previous request (may be missing and spotty but you
get the gist):
public class ContainerClass extends Activity
onCreate(Bundle savedInstanceState)
{
...
lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
Criteria myCriteria = new Criteria();
myCriteria.setAccuracy(Criteria.ACCURACY_FINE);
providerList = lm.getProviders(true);
for (String provider : providerList)
{
if (provider.equals(LocationManager.GPS_PROVIDER))
{
lm.requestLocationUpdates(provider, 7000, 20, gpsLocationListener);
}
else if (provider.equals(LocationManager.NETWORK_PROVIDER))
{
lm.requestLocationUpdates(provider, 7000, 20,
networkLocationListener);
}
}
}
// Wireless location listener
private final LocationListener networkLocationListener = new
LocationListener() {
public void onLocationChanged(Location location) {
ContainerClass.this.gpsLocationListener.onLocationChanged(location);
}
public void onProviderDisabled(String provider){}
public void onProviderEnabled(String provider) {}
public void onStatusChanged(String provider, int status, Bundle
extras) {}
};
// GPS location listener
private final LocationListener gpsLocationListener = new
LocationListener() {
public void onLocationChanged(Location location) {
//location.getProvider() will return which provider
supplied this location
//Logic when a location is found
if ((long)Math.floor(SystemClock.elapsedRealtime()/1000) -
locationTimeElapse > 7)
{
locationTimeElapse =
(long)Math.floor(SystemClock.elapsedRealtime()/1000);
currentLocationAccuracy += 10;
if (locationAccuracy > 1500f)
{
currentLocationAccuracy = 1500f;
}
}
if (location.getAccuracy() < 30.0 || location.getAccuracy() <=
currentLocationAccuracy)
{
currentLocationAccuracy = location.getAccuracy();
//and other junk happens
}
}
public void onProviderDisabled(String provider){}
public void onProviderEnabled(String provider) {}
public void onStatusChanged(String provider, int status, Bundle
extras) {}
};
On Jul 10, 9:13 pm, drpickett <[email protected]> wrote:
> > Maybe I
> > can be choosy and say that if it GPS then I demand 20 meter accuracy
> > but if it is network then I only demand 500 meter???
>
> Chuck Norris can "demand" a certain accuracy from GPS - You can't -
> GPS reports its accuracy to you - It is a function of the number of
> satellites in view, and other stuff
>
> dp
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en