title: Android Studio Google Maps Emulator stuck on location?
body: <p>I am a new learner in Java. As the title describes, I can't roam freely on google maps in the emulator PIXEL 2 API 29. The camera is stuck in the center of the location and no matter what I can't get the camera to elsewhere. I dont think it is the API cuz I have tested it without the code. Open to the suggestions, thank you. here is the code;</p>
  <p>`</p>
  <pre><code>import androidx.annotation.NonNull;
  import androidx.core.content.ContextCompat;
  import androidx.fragment.app.FragmentActivity;
  
  import android.Manifest;
  import android.content.Context;
  import android.content.pm.PackageManager;
  import android.location.Location;
  import android.location.LocationListener;
  import android.location.LocationManager;
  import android.os.Build;
  import android.os.Bundle;
  
  import com.google.android.gms.maps.CameraUpdateFactory;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.OnMapReadyCallback;
  import com.google.android.gms.maps.SupportMapFragment;
  import com.google.android.gms.maps.model.LatLng;
  import com.google.android.gms.maps.model.MarkerOptions;
  
  public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
  
      private GoogleMap mMap;
      LocationManager locationManager;
      LocationListener locationListener;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_maps);
          // Obtain the SupportMapFragment and get notified when the map is ready to be used.
          SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                  .findFragmentById(R.id.map);
          mapFragment.getMapAsync(this);
      }
  
  
      @Override
      public void onMapReady(GoogleMap googleMap) {
          mMap = googleMap;
          locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
          locationListener = new LocationListener() {
              @Override
              public void onLocationChanged(@NonNull Location location) {
                  LatLng userLocation = new LatLng(location.getLatitude(),location.getLongitude());
                  mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(userLocation,15));
                  System.out.println(&quot;location: &quot; + location);
  
  
              }
          };
  
          if(Build.VERSION.SDK_INT &gt;= 23) {
              if(checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED){
                  requestPermissions(new String[] {Manifest.permission.ACCESS_FINE_LOCATION},1);
              } else {
                  locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,0,locationListener);
  
              }
          }else {
              locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,0,locationListener);
  
          }
      }
  
      @Override
      public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
          super.onRequestPermissionsResult(requestCode, permissions, grantResults);
          if(grantResults.length&gt; 0){
              if(requestCode==1){
                  if(ContextCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED){
                      locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,0,locationListener);
                  }
              }
          }
  
      }
  }`
  </code></pre>