onRequestPermissionsResult not called
<p>Marshmallow Runtime Permission onRequestPermissionsResult was nor Called While running playstore Build Apk but working fine the normal debuging Apk.Anyone help me..Thanks.</p>
<h3>Here is my code</h3>
<pre><code>private void EnablePermissions() 
{
// Should we show an explanation?
if (ActivityCompat.shouldShowRequestPermissionRationale(this,android.Manifest.permission.RECORD_AUDIO)) {

    } else {

        // No explanation needed, we can request the permission.

        ActivityCompat.requestPermissions(this, new String[] { android.Manifest.permission.RECORD_AUDIO },
                MY_PERMISSIONS_REQUEST_RECORD);
        Toast.makeText(MainActivity.this, &quot;Permission Request&quot;, Toast.LENGTH_SHORT).show();
        // result of the request.
    }
    // Add a marker in Sydney, Australia, and move the camera.
    if (ContextCompat.checkSelfPermission(MainActivity.this,
            android.Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
        Toast.makeText(MainActivity.this, &quot;checkSelfPermission &quot;, Toast.LENGTH_SHORT).show();
        return;
    } else {
        Log.d(&quot;Permission Denied&quot;, &quot;Permission Failed to enable&quot;);
        Toast.makeText(MainActivity.this, &quot;Permission Failed to enable&quot;, Toast.LENGTH_SHORT).show();
    }
}
</code></pre>
<p>OnRequestPermissionResult Method</p>
<pre><code>public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
    try {
        switch (requestCode) {
        case MY_PERMISSIONS_REQUEST_RECORD: {
            // If request is cancelled, the result arrays are empty.
            if (grantResults.length &gt; 0 &amp;&amp; grantResults[0] == PackageManager.PERMISSION_GRANTED) {

                // permission was granted, yay! Do the
                // contacts-related task you need to do.
                ChatActivity();

            } else {
                Toast.makeText(MainActivity.this, &quot;Permission denied Chat &quot;, Toast.LENGTH_SHORT).show();
                // permission denied, boo! Disable the
                // functionality that depends on this permission.
            }
            return;
        }
        // other 'case' lines to check for other
        // permissions this app might request
        }

    } catch (Exception e) {
        Log.e(Constants.LOG, e.getMessage());
    }
}
</code></pre>