Code example for HandlerThread

Methods: getLooper, quit, start

0
		this.locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, getGpsUpdateInterval(), 0, this);
	} 
 
	public void startExternalGPSListener(){ 
		destroyExternalGPSListener(); 
		this.handlerThread = new HandlerThread("GPSHandler");
		this.handlerThread.start();
		this.handler = new Handler(this.handlerThread.getLooper());
		this.externalGPSTasks = new ExternalGPSTasks(this.gpsDevice,this.handler, this, getGpsUpdateInterval());
		this.handler.postDelayed(externalGPSTasks, getGpsUpdateInterval());
	} 
 
	public void destroyInternalGPSListener(){ 
		if(this.locationManager != null){
			this.locationManager.removeUpdates(this);
		} 
	} 
	 
	public void destroyExternalGPSListener(){ 
		if(this.handler != null){
			this.externalGPSTasks.closeBluetoothConnection();