How can I check permission under API level 23?
<p>One of my app has a permission <code>RECORD_AUDIO</code> and my app's <code>targetSdkVersion</code> is 22. I cannot check permission at runtime. But I notice if I install my app in Android 6.0 and above. Users can manually deny permission in System App permissions Settings. So my question is how can I check whether my app is grand Audio permission under API level 23?</p>

<p>I have searched for quite a long time but only find some <a href="https://developer.android.com/guide/topics/security/permissions.html#normal-dangerous" rel="noreferrer">document</a> about how to check permission in Android M.</p>

<p>I have noticed context has a function <a href="https://developer.android.com/reference/android/content/Context.html#checkCallingOrSelfPermission(java.lang.String)" rel="noreferrer">checkCallingOrSelfPermission</a>, but it's behavior is strange under Android 6.0. I am using the solution from <a href="https://stackoverflow.com/questions/7203668/how-permission-can-be-checked-at-runtime-without-throwing-securityexception">here</a>. But I after I manually close app permission in System App settings. The result I get is not what I expect.</p>

<pre><code>String permission = "android.permission.RECORD_AUDIO";
int ret = context.checkCallingPermission(permission);
</code></pre>

<p>Forget to mention:</p>

<pre><code>minSdkVersion 9
targetSdkVersion 22
</code></pre>

<p>Edit:</p>

<p>I have noticed that there is a <a href="https://stackoverflow.com/questions/32615013">solution</a> which is to upgrade v4 support lib to v23. It will be a little complex to upgrade my v4 support lib. So I want another solution.</p>