ashleymooney
ashleymooney

Reputation: 21

flutter Image_picker and Image_gallery_saver permissions to access phone gallery

I am new to flutter but I have a simple question.

I got my image picker plug in running fine on the emulator. When I go to run my app on a regular phone the image picker doesn't work. I was wondering if I have to ask user permission to save a photo to their gallery ? I was checking out some videos of permissions but I am wondering if I am on the right track.

adding to pubspec.yaml:
permission_handler: ^5.0.0+hotfix.6
image_gallery_saver: ^1.2.2
image_picker: 0.6.3+4


adding to AndroidManifest.xml:
    <uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />

Thanks, Ash

Upvotes: 1

Views: 12960

Answers (2)

abhijith k
abhijith k

Reputation: 399

<application
        android:requestLegacyExternalStorage="true">

</application>

add this in manifest under <application tag if no camera is opening

Upvotes: 1

Mohamad Eizeddin
Mohamad Eizeddin

Reputation: 896

If you do not have <uses-permission android:name="android.permission.CAMERA"> in AndroidManifest.xml, image_picker works.

If you do have <uses-permission android:name="android.permission.CAMERA">, then you either need to:

Request permission manually before calling ImagePicker.pickImage the first time Or Use another plugin which requires camera permissions first, and then use the ImagePicker.

Upvotes: 0

Related Questions