Skip to content
This repository was archived by the owner on Apr 12, 2022. It is now read-only.
This repository was archived by the owner on Apr 12, 2022. It is now read-only.

Android - Image picker is already active #20

Description

@pmagnuson

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions