Yuva
Yuva

Reputation: 171

how do manually remove microphone phone permission for camera plugin in flutter

Is it possible to remove asking microphone permission for camera plugin for android device using flutter

I have tried like below in my AndroidManifest.xml

but it shows error

Any one can help me to solve this issue. Thanks in advance

Upvotes: 8

Views: 5130

Answers (3)

Pius T.K
Pius T.K

Reputation: 427

disable audio for camera controller

controller = CameraController(
        cameras.first,
        ResolutionPreset.medium,
        enableAudio: false,
        imageFormatGroup: Helpers.isIOS ? ImageFormatGroup.bgra8888 : ImageFormatGroup.yuv420,
    );

Upvotes: 6

Elmar
Elmar

Reputation: 4445

One important thing. enableAudio: false parameter can only be passed as the last parameter to the CameraController. Like below:

_controller = CameraController(firstCamera, ResolutionPreset.medium,
    enableAudio: false);

All other attempts will cause syntax error. Adding this one helps to avoid adding additional NSMicrophoneUsageDescription in info.plist. Otherwise app will crash with this error:

"This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSMicrophoneUsageDescription key with a string value explaining to the user how the app uses this data."

Upvotes: 19

Gazi Mohib
Gazi Mohib

Reputation: 71

You can request camera permission only by passing the parameter enableAudio: false to the CameraController (0.5.2+1 ++).

Upvotes: 2

Related Questions