public void initLocation() { try { try { if (!Settings.getInstance() .getBooleanValue(getText(R.string.settings_key_gps).toString())) { log.log(Level.FINE, "GPS is disabled in settings"); return; } } catch (NoSuchFieldError e) { log.log(Level.SEVERE, "", e); return; } List providers = this.getLocationManager().getProviders(true); if (providers.size() == 0) { log.log(Level.FINE, "no location providers enabled"); this.showLocationSourceDialog(); } else { log.log(Level.FINE, "location handler start"); locationHandler.start(); this.setLocationHandlerEnabled(true); // manager.initLocation(); } } catch (Exception e) { log.log(Level.SEVERE, "", e); } }
/** starts the LocationHandler */ public void enableGPS() { try { this.initLocation(); locationHandler.setLocationTimer(new LocationTimer(locationHandler)); } catch (Exception e) { log.log(Level.SEVERE, "", e); } }
/** Unregisters LocationListener. */ @Override public void onDestroy() { try { super.onDestroy(); log.log(Level.FINE, "on destroy MapLocation"); locationHandler.stop(); } catch (Exception e) { log.log(Level.SEVERE, "", e); } }
public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { CompatManager.getInstance().getRegisteredLogHandler().configureLogger(log); Config.setContext(this); locationHandler = new LocationHandler( (LocationManager) getSystemService(Context.LOCATION_SERVICE), this, this); initLocation(); locationHandler.setLocationTimer(new LocationTimer(locationHandler)); // manager = new GPSManager(getLocationManager(), this, this/*, // true*/); // manager.setGPSTask(new LocationTimer(manager)); this.initializeSensor(this); } catch (Exception e) { log.log(Level.SEVERE, "", e); } }