One of my app has a permission RECORD_AUDIO
and my app's targetSdkVersion
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?
I have searched for quite a long time but only find some document about how to check permission in Android M.
I have noticed context has a function checkCallingOrSelfPermission, but it's behavior is strange under Android 6.0. I am using the solution from here. But I after I manually close app permission in System App settings. The result I get is not what I expect.
String permission = "android.permission.RECORD_AUDIO";
int ret = context.checkCallingPermission(permission);
Forget to mention:
minSdkVersion 9
targetSdkVersion 22
Edit:
I have noticed that there is a solution 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.