3

I'm using multi_image_picker to allow picking images in my Flutter app.

I've noticed odd behavior when I download an image and store in the Download folder of the device, and the following things happen:

  1. After I download an image, I trigger the image picker (by running MultiImagePicker.pickImages).
  2. Image Picker doesn't show the image, which is odd since I've downloaded the image.
  3. I'm navigating to the Android Files app and I do find the image.
  4. Restarting my app and navigating again to the Image Picker, but still - image not exists.
  5. Opening Google Photos app and after a second the image appears.
  6. Navigating back to my app -> Image Picker, and then I see the image.

I know it sounds odd. I have no idea how or why it happens. I'm using Flutter 1.10.3 and a fresh Android API 28 emulator. I ran the app in an Android Q too and the results are the same.

Eliya Cohen
  • 10,716
  • 13
  • 59
  • 116
  • 1
    try to open an issue [at the plugin repository](https://github.com/Sh1d0w/multi_image_picker/issues) – Mohamed Elrashid Sep 22 '19 at 19:19
  • might be the browser is not making an entry using [ContentProvider#insertImage](https://developer.android.com/reference/android/provider/MediaStore.Images.Media.html#insertImage(android.content.ContentResolver,%20java.lang.String,%20java.lang.String,%20java.lang.String)). And about Google Photos, it tracks all the old and new photos and videos on storage if the entry is not found in ContentProvider it makes a new entry so that photo or video can be accessed by other apps like MultiImagePicker. – Mayur Prajapati Sep 28 '19 at 08:20
  • @MayurPrajapati Do you have a solution? – Eliya Cohen Sep 28 '19 at 12:23
  • I've seen the code for [multi_image_picker](https://pub.dev/packages/multi_image_picker) it is using content providers and they are not updated, so probably you can use another plugin to pickup photos direct from Google Photos or Gallery e.g. [image_picker](https://pub.dev/packages/image_picker) – Mayur Prajapati Sep 28 '19 at 14:29

2 Answers2

0

Looks like your download directory and your GooglePhotos sync directory are in two different places and MultiImage.pickImages is looking at the GooglePhotosSync directory (which might also be the devices CameraRoll directory).

So you are dependent on GooglePhotos uploading the photo from one place and downloading it to another.

Most of my work is ios so sorry I cant be more specific.

Chris Reynolds
  • 5,453
  • 1
  • 15
  • 12
  • The image stays where it is, and it's bot being duplicated into a different folder, and multi image picker is pointing to the the origin url, so I believe your answer is incorrect. – Eliya Cohen Sep 28 '19 at 12:22
  • Well to test my theory. You could download a picture, put your phone into flight mode, do your google photo dance and app restart. This would tell you whether it is cloud syncing or a caching issue. – Chris Reynolds Sep 29 '19 at 22:30
0

I observed similar behavior in terms of some photos not showing when picking image from gallery.

I just found the cause 5 minutes ago before asking "Have you found out the solution?"

It turns out, the flutter image pickter starts from "Recent" folder, the photos I have recently downloaded have much older timestamp. So these photos are futher down in the list.

I will look into a solution.

dubu
  • 1