Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Geo Fix command does not pass altitude

On Android 2.2 Emulator, the "geo fix" command seems not to be working properly. The emulator responds "OK", and onLocationChanged() is properly called in my program. However, the Location object seems not to be complete - it registers latitude and longitude just fine, but it does not contain an altitude reading: hasAltitude() returns false.

Any ideas why?

Example emulator commands:

geo fix -74 40.75 500
geo fix -77 39 400.0

Code snippet:

public void onLocationChanged(Location loc) {
    System.out.println("onLocationChanged Called");
    if (loc.hasAltitude()) {
        double newalt = loc.getAltitude();
        System.out.println("new altitude: " + newalt);
        gps[ALTITUDE] = newalt;
    } else {
        System.out.println("No altitude fix");
    }
    gps[LONG] = loc.getLongitude();
    System.out.println(gps[LONG]);
    gps[LAT] = loc.getLatitude();
    System.out.println(gps[LAT]);
}

Sample Output:

onLocationChanged Called
No altitude fix
-74.012333333333333333
40.756666666666666667
onLocationChanged Called
No altitude fix
-77.012833333333333335
39.006499999999999996
like image 687
SirBoss Avatar asked Jul 20 '10 17:07

SirBoss


1 Answers

This is a bug in the emulator and has been reported at https://code.google.com/p/android/issues/detail?id=24809

like image 85
Breandán Dalton Avatar answered Oct 10 '22 11:10

Breandán Dalton