@Override public void changeSettings(String settings) { String[] splitted = settings.split(FieldDelimiter); if (splitted.length != 3 || !splitted[0].equals(type.toString())) throw new RuntimeException("wrong setting string for gps: " + settings); // cancel the current scanning locationManager.removeUpdates(locationListener); this.isEnabled = (splitted[1].equals("1")); this.scanIntervalInMs = Integer.parseInt(splitted[2]); System.out.println("change GPS settings to: (" + isEnabled + ", " + scanIntervalInMs + ")"); if (isEnabled) locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, scanIntervalInMs, 0, locationListener); else logger.flushFile(type); }