コード例 #1
0
  @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);
  }
コード例 #2
0
  @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);
  }