-
-
Notifications
You must be signed in to change notification settings - Fork 36
Android - Image picker is already active #20
Description
I have a Flutter app which works correctly under IOS. When running under Android, I get an error each time a call to MultiImagePicker.pickImages is made. The error is
PlatformException(already_active, Image picker is already active, null, null)
My application has not yet been migrated to null safety, so I am using version multi_image_picker2: ^4.7.15.
I have included thee permissions below in my android/app/src/main/AndroidManifest.xml.
I appears the call to _channel.invokeMethod is causing the error.
final List<dynamic> images = await _channel.invokeMethod(
'pickImages',
<String, dynamic>{
'maxImages': maxImages,
'enableCamera': enableCamera,
'iosOptions': cupertinoOptions.toJson(),
'androidOptions': materialOptions.toJson(),
'selectedAssets': selectedAssets
.map(
(Asset asset) => asset.identifier,
)
.toList(),
},
);Any advice appreciated.
Originally posted by @rebink in #9 (comment)
To allow the following permissions in your Manifest:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
If your app targets Android 11 with compileSdk/targetSdk >= 30 then you will need to add this to the manifest (outside of the application block) in order to capture pictures with the device camera. Android documentation here:
<queries>
<intent>
<action android:name="android.media.action.IMAGE_CAPTURE" />
</intent>
</queries>