Code example for GeomagneticField

Methods: getDeclination

0
        if (timestamp == 0) {
          // Hack for Samsung phones which don't populate the time field 
          timestamp = System.currentTimeMillis();
        } 
 
        GeomagneticField field = new GeomagneticField(
            (float) location.getLatitude(),
            (float) location.getLongitude(),
            (float) location.getAltitude(),
            timestamp);
        variation = field.getDeclination();
      } 
 
     
    public void onLocationChanged(Location location) {
		super.onLocationChanged(location);
/* 
        GeoPoint point = new GeoPoint( 
                (int) ((double) location.getLatitude() * E6), 
                (int) ((double) location.getLongitude() * E6));