Code example for LocationManager

Methods: removeGpsStatusListenerremoveUpdates

0
 
	@Override 
	protected void handleStop() { 
		Log.d(TAG, "Stop gpsStatus");
		if (location!=null) {
			location.removeGpsStatusListener(this);
			location.removeUpdates(this);
		} 
	} 
 
	public void onGpsStatusChanged(int type) {
		if (location!=null) {
			GpsStatus status = location.getGpsStatus(null);
			JSONObject value = new JSONObject();
			try { 
				// event time is in nanoseconds 
				value.put("timestamp", System.currentTimeMillis());
				value.put("status", type);
				value.put("maxSatellites", status.getMaxSatellites());
				value.put("timeToFirstFix", status.getTimeToFirstFix());