@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_gps) { if (!utils.isGpsEnabled()) makeGpsDialog().show(); else { Location location = utils.getUserLocation(); locationListener.onLocationChanged(location); } return true; } return super.onOptionsItemSelected(item); }
@Override protected void onResume() { super.onResume(); if (!utils.isGpsEnabled()) makeGpsDialog().show(); else { if (userLocation == null) { Location location = utils.getUserLocation(); locationListener.onLocationChanged(location); } } if (locationListenerEnabled && !utils.isLocationListenerExists()) utils.setUserLocationRequestInterval( locationListener, GpsUtils.GPS_INTERVAL_TIME_INTENSE, GpsUtils.GPS_INTERVAL_TIME_INTENSE); }
@Override protected void onDestroy() { super.onDestroy(); try { utils.removeUserLocationRequestInterval(); } catch (SecurityException e) { e.printStackTrace(); } }