title: Android runtime permissions dialog not showing
body: <p>I am trying to get permissions (from users running versions of Android higher than 6.0) for ACCESS_FINE_LOCATION at runtime. This was unsuccessful in my main app so I tried making a test app with a sole purpose of requesting location permissions from the user.</p>
  
  <p>The problem I am having is that no permissions dialog box is being shown to the user - from the logcat I can see that the 'onRequestPermissionsResult' method is being run straight away (without asking the user to accept permissions), and it is showing that permissions were not granted.</p>
  
  <p>After looking through other questions around this topic, I have double checked that the 'uses-permission' line is in my Android Manifest XML file, but couldn't find any other solution.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>package com.user.testapplication;
  
  import android.Manifest;
  import android.content.pm.PackageManager;
  import android.os.Build;
  import android.support.v4.content.ContextCompat;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.util.Log;
  
  public class MainActivity extends AppCompatActivity {
  
  private static final int REQUEST_LOCATION_ID = 1;
  private static final String TAG = MainActivity.class.getSimpleName();
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      checkLocationPermissions();
  }
  
  private void checkLocationPermissions(){
      if (ContextCompat.checkSelfPermission(MainActivity.this,
              Manifest.permission.ACCESS_FINE_LOCATION)
              != PackageManager.PERMISSION_GRANTED) {
  
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M) {
              Log.i(TAG, "Device version above 6.0 - Requesting location permissions.");
              requestPermissions(new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
                      REQUEST_LOCATION_ID);
          }
  
      }
  }
  
  @Override
  public void onRequestPermissionsResult(int requestCode,
                                         String permissions[], int[] grantResults) {
      switch (requestCode) {
          case REQUEST_LOCATION_ID: {
              // If request is cancelled, the result arrays are empty.
              if (grantResults.length &gt; 0
                      &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                  Log.i(TAG, "Permissions granted successfully!");
  
              } else {
                  Log.i(TAG, "Permissions were not granted.");
              }
              return;
          }
      }//end switch
  }
  
  }//end class
  </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.user.testapplication"&gt;
  
  &lt;uses-permission android:name="android.permisssion.ACCESS_FINE_LOCATION"/&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;activity android:name=".MainActivity"&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;
  </code></pre>
  
  <p></p>
  
  <p>And the relevant lines from the logcat:</p>
  
  <pre><code>11-27 13:27:47.752 31839-31839/com.user.testapplication I/MainActivity: Device version above 6.0 - Requesting location permissions.
  11-27 13:27:47.881 31839-31839/com.user.testapplication I/MainActivity: Permissions were not granted.
  </code></pre>
  
  <p>Any help is much appreciated - I think I may just be missing something.</p>