title: LocationManager not displaying location in GoogleMap
body: <p>I am trying to build my first android app that tracks the users location. I am trying to achieve this with the following java code in my Maps Activity Class:</p>
  
  <pre><code>public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
  
  private GoogleMap mMap;
  LocationManager locationManager;
  
  @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);
      locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
      if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp; ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
          return;
      }
      if(locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
          locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, new LocationListener() {
              @Override
              public void onLocationChanged(Location location) {
                  double latitude = location.getLatitude();
                  double longitude = location.getLongitude();
  
                  LatLng latLng = new LatLng(latitude, longitude);
                  Geocoder geocoder = new Geocoder(getApplicationContext());
                  try {
                      List&lt;Address&gt; addressList = geocoder.getFromLocation(latitude, longitude, 1);
                      String str = addressList.get(0).getLocality();
                      mMap.addMarker(new MarkerOptions().position(latLng).title(str));
                      mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 10.2f));
                  }catch (IOException e){
                      e.printStackTrace();
                  }
  
              }
  
              @Override
              public void onStatusChanged(String provider, int status, Bundle extras) {
  
              }
  
              @Override
              public void onProviderEnabled(String provider) {
  
              }
  
              @Override
              public void onProviderDisabled(String provider) {
  
              }
          });
      }else if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){
          locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, new LocationListener() {
              @Override
              public void onLocationChanged(Location location) {
                  double latitude = location.getLatitude();
                  double longitude = location.getLongitude();
  
                  LatLng latLng = new LatLng(latitude, longitude);
                  Geocoder geocoder = new Geocoder(getApplicationContext());
                  try {
                      List&lt;Address&gt; addressList = geocoder.getFromLocation(latitude, longitude, 1);
                      String str = addressList.get(0).getLocality();
                      mMap.addMarker(new MarkerOptions().position(latLng).title(str));
                      mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 10.2f));
                  }catch (IOException e){
                      e.printStackTrace();
                  }
              }
  
              @Override
              public void onStatusChanged(String provider, int status, Bundle extras) {
  
              }
  
              @Override
              public void onProviderEnabled(String provider) {
  
              }
  
              @Override
              public void onProviderDisabled(String provider) {
  
              }
          });
      }
  }
  
  @Override
  public void onMapReady(GoogleMap googleMap) {
      mMap = googleMap;
  
      // Add a marker in Sydney and move the camera
      //LatLng sydney = new LatLng(-34, 151);
      //mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
      //mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
  }
  </code></pre>
  
  <p>And the following permission </p>
  
  <pre><code> &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  </code></pre>
  
  <p>However my Android phone and emulator only display the global maps view.
  The application does the API call and request everything it needs, but the information doesn't get displayed.</p>
  
  <p><a href="https://i.stack.imgur.com/rO88J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rO88J.png" alt="enter image description here"></a></p>
  
  <p>Also when just placing markers on the map in void <code>onMapReady(GoogleMap googleMap)</code> it does work.</p>
  
  <p>I am testing my application on a Samsung Galaxy S5 and an emulated Nexus 5X. </p>
  
  <p>Compile version: 7.1.1
  Build Tools Version 26.0.2</p>