im trying to record sound from dictaphone but on android 6+ i get permission error. I add code for asking permission (have 3 permissions for ask ) 2 work but CAPTURE_AUDIO_OUTPUT show error. Its just not ask me to grant permission. In logs its just "not granted" Any one know in what problem ?
public static boolean PermissionCheck(Activity context, String permission, int code) {
boolean state = false;
int permissionCheck = ContextCompat.checkSelfPermission(context,
permission);
if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(context, new String[]{permission}, code); // define this constant yourself
} else {
// you have the permission
return true;
}
return state;
}
case CAPTURE_AUDIO_OUTPUT_CONSTANT: {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Logger.e("CAPTURE PERMISSION GRANTED");
INIT();
} else {
Logger.e("CAPTURE PERMISSION NOT GRANTED");
finish();
}
return;
}
error
W/PackageManager: Not granting permission android.permission.CAPTURE_AUDIO_OUTPUT to package blabla_package (protectionLevel=18 flags=0x3848be46)
in manifest
<uses-permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT"/>
[UPD] After a lot of tries and researches i now can answer : Thank to google , now we cant record calls. Its possible only if using C code and NDK .
CAPTURE_AUDIO_OUTPUT
is not a dangerous
permission and so does not work with the runtime permission system. CAPTURE_AUDIO_OUTPUT
has android:protectionLevel="signature|privileged"
, so it can only be held by apps that are installed on the privileged (a.k.a., system) partition or are signed by the platform signing key.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With