I am trying to use flutter_sound to record some audio and also use permission_handler to request permission for audio. However, I get this error No permissions found in manifest for: []33
Here is the setup for android
androidappsrcmainAndroidManifest
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
In build.gradle, I have
defaultConfig {
applicationId "com.example"
minSdkVersion flutterMinSdkVersion.toInteger()
targetSdkVersion flutterTargetSdkVersion.toInteger() // 33 in local.properties
compileSdkVersion flutterCompileSdkVersion.toInteger() // 33 in local.properties
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Here is the code I request permission and start recording
var status = await Permission.audio.status;
if (!status.isGranted || !status.isPermanentlyDenied) {
await Permission.audio.request();
}
if (!status.isGranted || !status.isPermanentlyDenied) {
return false;
}
await openRecorderSession();
if (_recorder != null && isRecordingStopped()) {
await _recorder?.startRecorder(
toFile: path,
codec: Codec.aacMP4,
);
return true;
}
2
Answers
you can use this permission for read media according to this android doc https://developer.android.com/about/versions/13/behavior-changes-13