Android Marshmallow - how to know "Never ask again" is checked before
<p>I want to request for the permission android.permission.ACCESS_COARSE_LOCATION for getting tower location.</p>

<p>But before requesting for that permission, i want to know whether it is blocked by the user by checking "Never ask again" check box.</p>

<p>Is there a proper way to know "Never ask again" for a permission?</p>

<p>=======================Requirement==========================</p>

<p>I want to prevent user from entering the screen without granting location access permission.</p>

<p>So I am using the permission request as a function named 
  requestLocation() which is called in onResume().</p>

<p>Inside requestLocation()</p>

<p>-> Check for permission</p>

<p>-> If : permission already granted, register update location.</p>

<p>-> ELSE : not granted, show dialogue for grant permission with two button</p>

<p>-> One button execute the code "ActivityCompat.requestPermissions(..........);" and showing the in-built pop up for permission.</p>

<p>-> Another button helps to exit from the application.</p>

<p>When deny or grant is flagged in onRequestPermissionsResult(), then requestLocation() will executed again.</p>

<p>But in the case when "Never show again" is checked and deny is clicked, the infinite loop will continue as like the following</p>

<p>onRequestPermissionsResult()=></p>

<p>PERMISSION_DENIED =></p>

<p>requestLocation()=></p>

<p>Permission not granted => </p>

<p>ActivityCompat.requestPermissions(..........); => </p>

<p>onRequestPermissionsResult() => PERMISSION_DENIED =>requestLocation()=></p>

<p>Permission not granted => </p>

<p>ActivityCompat.requestPermissions(..........); </p>

<p>=>...............</p>

<p>So if I can understand whether "Never show again" is clicked or not, I can exit from the loop by checking it inside requestLocation().</p>