public void setOverwritingStatus ( boolean enabled ) { mOverwriteNativeStatus = enabled ; mNativeGpsOverridden = false ; if ( mLocationManager != null && ! enabled ) { try { mLocationManager . removeTestProvider ( LocationManager . GPS_PROVIDER ) ; Log . d ( TAG , "Disabled overwriting native GPS with OpenXC GPS" ) ; } catch ( IllegalArgumentException e ) { Log . d ( TAG , "Unable to remove GPS test provider - " + "probably wasn't added yet" ) ; } mVehicleManager . removeListener ( Latitude . class , this ) ; mVehicleManager . removeListener ( Longitude . class , this ) ; mVehicleManager . removeListener ( VehicleSpeed . class , this ) ; } else { Log . d ( TAG , "Enabled overwriting native GPS with OpenXC GPS" ) ; mVehicleManager . addListener ( Latitude . class , this ) ; mVehicleManager . addListener ( Longitude . class , this ) ; mVehicleManager . addListener ( VehicleSpeed . class , this ) ; } }
Enable or disable overwriting Android s native GPS values with those from the vehicle .