title: how I can show current user location in Google Map only once, when I open the fragment?
body: <p>how I can show current user location in Google Map only once, when I open the fragment in Android Studio?
  I use this code, but camera constant move to the user current location. When the user moves the map, it automatically moves back to the current location.</p>
  <pre><code>public class MapsFragment extends Fragment implements GoogleApiClient.ConnectionCallbacks,
          GoogleApiClient.OnConnectionFailedListener,
          LocationListener, OnMapReadyCallback {
  
  private SharedPreferences sharedPref;
  
  private GoogleMap gMap;
  
  private GoogleApiClient mGoogleApiClient;
  private LocationRequest mLocationRequest;
  
  private Location locationData;
  
  
  private static final long TIME_INTERVAL_GET_LOCATION = 1000 * 5; 
  private final static int CONNECTION_FAILURE_RESOLUTION_REQUEST = 5000;
  
  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          sharedPref = PreferenceManager.getDefaultSharedPreferences(getContext());
  
          View rootView = inflater.inflate(R.layout.fragment_map, null);
  
          SupportMapFragment mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);
  
          mapFragment.getMapAsync(this);
  
          TedPermission.with(getActivity())
          .setPermissionListener(permissionlistener)
          .setDeniedMessage(&quot;If you reject permission,you can not use this service\n\nPlease turn on permissions at [Setting] &gt; [Permission]&quot;)
          .setPermissions(Manifest.permission.ACCESS_FINE_LOCATION)
          .check();
  
          mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
          .addConnectionCallbacks(this)
          .addOnConnectionFailedListener(this)
          .addApi(LocationServices.API)
          .build();
  
          return rootView;
          }
  
  
  @Override
  public void onResume() {
          super.onResume();
  
  
          }
  
          PermissionListener permissionlistener = new PermissionListener() {
  @Override
  public void onPermissionGranted() {
  
          mLocationRequest = LocationRequest.create()
          .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY)
          .setInterval(TIME_INTERVAL_GET_LOCATION)    
          .setFastestInterval(TIME_INTERVAL_GET_LOCATION); 
  
  
          if (!mGoogleApiClient.isConnected()) {
          mGoogleApiClient.connect();
          locationChecker(mGoogleApiClient, getActivity());
          }
          }
  
  @Override
  public void onPermissionDenied(ArrayList&lt;String&gt; deniedPermissions) {
          }
          };
  
  @Override
  public void onConnected(@Nullable Bundle bundle) {
  
          if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp;
          ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
  
          return;
          }
    
  
          FusedLocationProviderClient mFusedLocationClient = LocationServices.getFusedLocationProviderClient(getActivity());
          mFusedLocationClient.requestLocationUpdates(mLocationRequest, new LocationCallback() {
  @Override
  public void onLocationResult(LocationResult locationResult) {
          locationData = locationResult.getLastLocation();
          if (locationData != null) {
  
          LatLng myLocation = new LatLng(locationData.getLatitude(), locationData.getLongitude());
  
          gMap.clear();
  
          gMap.addMarker(new MarkerOptions().position(myLocation).title(&quot;You are here!&quot;).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));
  
          CameraPosition cameraPosition = new CameraPosition.Builder().target(myLocation).zoom(14).build();
          gMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
     
  
          }
  
          }
          }, null);
  
          }
  
  @Override
  public void onConnectionSuspended(int i) {
  
          }
  
  @Override
  public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
  
         //........
          
  
          }
  
  public void locationChecker(GoogleApiClient mGoogleApiClient, final Activity activity) {
          LocationRequest locationRequest = LocationRequest.create();
          locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
          locationRequest.setInterval(30 * 1000);
          locationRequest.setFastestInterval(5 * 1000);
          LocationSettingsRequest.Builder builder = new LocationSettingsRequest.Builder()
          .addLocationRequest(locationRequest);
          builder.setAlwaysShow(true);
          PendingResult&lt;LocationSettingsResult&gt; result =
          LocationServices.SettingsApi.checkLocationSettings(mGoogleApiClient, builder.build());
          result.setResultCallback(new ResultCallback&lt;LocationSettingsResult&gt;() {
  @Override
  public void onResult(LocationSettingsResult result) {
  final Status status = result.getStatus();
  final LocationSettingsStates state = result.getLocationSettingsStates();
          switch (status.getStatusCode()) {
          case LocationSettingsStatusCodes.SUCCESS:
          
          break;
          case LocationSettingsStatusCodes.RESOLUTION_REQUIRED:
         
          try {
         
          status.startResolutionForResult(activity, 1000);
  
          } catch (IntentSender.SendIntentException e) {
          
          }
          break;
          case LocationSettingsStatusCodes.SETTINGS_CHANGE_UNAVAILABLE:
         
          break;
          }
          }
  
              });
          }
  
  @Override
  public void onLocationChanged(Location location) {
      {
  
  
          }
          }
  
      @Override
      public void onStatusChanged(String s, int i, Bundle bundle) {
  
      }
  
      @Override
      public void onProviderEnabled(String s) {
  
      }
  
      @Override
      public void onProviderDisabled(String s) {
  
      }
  
      @Override
  public void onMapReady(GoogleMap googleMap) {
          gMap = googleMap;
          gMap.getUiSettings().setZoomControlsEnabled(false);
          gMap.setBuildingsEnabled(false);
          gMap.getUiSettings().setCompassEnabled(true);
          gMap.getUiSettings().setCompassEnabled(true);
          gMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
          gMap.setIndoorEnabled(false);
          gMap.getUiSettings().setRotateGesturesEnabled(true);
  
  
  
            
          }
  
  
  }
  </code></pre>
  <p>What I should to do to fix that? How i can turn off the map animation to current location?</p>