title: GoogleMap.getMyLocation() returns null
body: <p>I am trying to zoom into the user's current location on a map. The location is definitely accessible because it is showing as a blue dot on map 
  <a href="https://i.stack.imgur.com/zwUKP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zwUKP.png" alt="enter image description here"></a></p>
  
  <p>However, <code>GoogleMap.getMyLocation(</code>) is returning null. </p>
  
  <p>In order to enable location data I followed the <a href="https://developers.google.com/maps/documentation/android-api/location?hl=en" rel="nofollow noreferrer">Google documentation</a> and added the proper permissions in my manifest, in addition to adding the necessary the API key.</p>
  
  <p>If it is helpful at all my MyActivity.java: </p>
  
  <pre><code>package com.example.beckah.helloworld;
  
  import android.support.v4.app.FragmentActivity;
  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;
  import android.location.Location;
  import android.location.LocationListener;
  import android.content.Context;
  import android.location.LocationManager;
  
  public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
  
      private GoogleMap mMap;
      private LatLng location;
      Location mLocation;
      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);
      }
  
  
      /**
       * Manipulates the map once available.
       * This callback is triggered when the map is ready to be used.
       * This is where we can add markers or lines, add listeners or move the camera. In this case,
       * we just add a marker near Sydney, Australia.
       * If Google Play services is not installed on the device, the user will be prompted to install
       * it inside the SupportMapFragment. This method will only be triggered once the user has
       * installed Google Play services and returned to the app.
       */
      @Override
      public void onMapReady(GoogleMap googleMap) {
          mMap = googleMap;
  
          mMap.setMyLocationEnabled(true);
          locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
  
          mLocation = googleMap.getMyLocation();
  
  
          if(mLocation != null) location = new LatLng(mLocation.getLatitude(), mLocation.getLongitude());
          else location = new LatLng(31, 31);
  
          mMap.addMarker(new MarkerOptions().position(location).title("Marker in Sydney"));
          mMap.moveCamera(CameraUpdateFactory.newLatLng(location));
  
  
      }
  }
  </code></pre>
  
  <p>My manifest: </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.beckah.helloworld"&gt;
  
      &lt;!--
           The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
           Google Maps Android API v2, but you must specify either coarse or fine
           location permissions for the 'MyLocation' functionality. 
      --&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_GPS" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  
      &lt;permission android:name="com.example.beckah.helloworld.permission.MAPS_RECEIVE"
          android:protectionLevel="signature"/&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
  
          &lt;!--
               The API key for Google Maps-based APIs is defined as a string resource.
               (See the file "res/values/google_maps_api.xml").
               Note that the API key is linked to the encryption key used to sign the APK.
               You need a different API key for each encryption key, including the release key that is used to
               sign the APK for publishing.
               You can define the keys for the debug and release targets in src/debug/ and src/release/. 
          --&gt;
          &lt;meta-data
              android:name="com.google.android.geo.API_KEY"
              android:value="@string/google_maps_key" /&gt;
  
          &lt;activity
              android:name=".MapsActivity"
              android:label="@string/title_activity_maps"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>How can I ensure that GoogleMap.getMyLocation() does not return null and is able to get the location data?</p>