Code example for Location

Methods: getAccuracygetLatitudegetLongitudehasAccuracy

0
   
  private boolean horribleGps(final Location location) {
    // try to protect against some horrible gps's out there 
    boolean horrible = false;
    // check if accuracy is under 10 miles 
    horrible |= location.hasAccuracy() && location.getAccuracy() > 16000;
    horrible |= location.getLatitude() < -90 || location.getLatitude() > 90;
    horrible |= location.getLongitude() < -180 || location.getLongitude() > 180;
    return horrible;
  } 
   
  public int getSatCount() { 
    int satCount = 0;
    if ( gpsStatus != null ) {
      for ( GpsSatellite sat : gpsStatus.getSatellites() ) {
        if ( sat.usedInFix() ) {
          satCount++;
        } 
      } 
    } 
    return satCount;