title: Missing permissions required by LocationManager.requestLocationUpdates
body: <p>I have used the permissions in manifest file and permissions during runtime too.
  But i still get the error</p>
  
  <blockquote>
    <p>"Missing permissions required by LocationManager.requestLocationUpdates: android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION 
    Inspection info:This check scans through your code and libraries and looks at the APIs being used, and checks this against the set of permissions required to access those APIs. If the code using those APIs is called at runtime, then the program will crash.  Furthermore, for permissions that are revocable (with targetSdkVersion 23), client code must also be prepared to handle the calls throwing an exception if the user rejects the request for permission at runtime. 
    Issue id: MissingPermission"</p>
  </blockquote>
  
  <p>I'm using Android Studio 3.4.1</p>
  
  <p>Manifest file:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&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_NETWORK_STATE" /&gt;
  </code></pre>
  
  <p>In the Activity:</p>
  
  <pre><code> public void getLocation()
  {
      try {
          locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
          locationManager.requestLocationUpdates(LocationManager.PASSIVE_PROVIDER, 5000, 5, this);
      }
      catch(SecurityException e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>In the onCreate() method:</p>
  
  <pre><code>if (ContextCompat.checkSelfPermission(getApplicationContext(),android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp; ActivityCompat.checkSelfPermission(getApplicationContext(),android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
  
          ActivityCompat.requestPermissions(this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION,android.Manifest.permission.ACCESS_COARSE_LOCATION}, 101);
      }
  </code></pre>
  
  <p>Please help me out. I have gone through posts related to this but doesn't help me at all.</p>