Downloaded images not showing in phone's gallery, flutter - android

My flutter app is successfully downloading media to 'android/media/com.example.testapp/testapp/images/'. I can see them via file explorer but for some reason I am not able to see them in gallery. Earlier I was storing images outside of the android storage at that time Images were showing in gallery. I'm using mediascanner for this.
print(directory.path);//outputs /storage/emulated/0/Android/media/com.example.testapp/testapp/images/image1.jpg
MediaScanner.loadMedia(path: directory.path);

I think the problem is that, you aren't telling the OS about new image or video, for this you need to use Android Intent or use this plugin https://pub.dev/packages/image_gallery_saver, it will update the media files every time you save your file using this plugin

Related

Multi Image Picker doesn't locate my image until I open Google Photos in Flutter

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:
After I download an image, I trigger the image picker (by running MultiImagePicker.pickImages).
Image Picker doesn't show the image, which is odd since I've downloaded the image.
I'm navigating to the Android Files app and I do find the image.
Restarting my app and navigating again to the Image Picker, but still - image not exists.
Opening Google Photos app and after a second the image appears.
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.
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.
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.

Capturing video automatically and saved in phone in cordova android

I have implemented video capturing facility in cordova using this plugin(https://github.com/EddyVerbruggen/VideoCapturePlus-PhoneGap-Plugin). But I need capture the video automatically and save to memory without any user actions,Also i want to get the path of saved Video.Is it possible with this plugin??
//this only prompt to turn on camera automatically
window.plugins.videocaptureplus.captureVideo(captureSuccess, captureError, {limit:1, duration:10});
Also i want to get the path of saved Video
I used the Cordova LibraryHelper plugin. It has a method that will save to the native camera roll/app, just pass it the mediafile path after you grab it with VideoCapturePlus and pass the name of the album you want the files to save it.
It supports Android & iOS although I've only used it for iOS.

How to avoid saving picture at gallery or delete it automatically in Android?

The device is Samsung Galaxy III. I developed an APP to run the camera activity and capture an image. After analyzing the image, I print out some text information. Right now every captured image is saved at gallery. I don't need the image to be saved in gallery or SD card. I think either of the following two solutions will work for me, but I don't know how to program it:
avoid saving pictures to gallery.
delete the picture somewhere in the APP.
Any comments are appreciated.
Read Android Camera tutorial.
...
Storage - Are the images or videos your application generates intended to be only visible to your application or shared so that other applications such as Gallery or other media and social apps can use them? Do you want the pictures and videos to be available even if your application is uninstalled? Check out the Saving Media Files section to see how to implement these options.
or see this one: How to save image captured with camera in specific folder.
In the Camera intent when starting, add this:
intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(getTempFile(context)));
I solved my problem with following two steps:
as '#auselen' pointed, save all the images to a specific folder. How to save image captured with camera in specific folder.
delete all the images in that folder somewhere in the APP. How to Delete Image From SDCard in Android
use this for delete a pic
ImgPhoto1.setImageBitmap(null);

When I try to push a photo onto the android emulator, I am not able to see the photo in Albums

I am new to Android and now trying to retrieve contact photo (thumb nail) from a content provider and set it onto my app. But for that as i am running on an AVD, i pushed some .png photos onto my 2.2 version. Now i tried to create a contact with the photo, but the Gallery is showing "No Media Found", hence i am stuck here.
Please help me in getting the photo visible in gallery.
Note : I am aware of the following facts :
I have restarted my AVD to force the Media Scanner to do its initial mockups.
Also i have seen the .png file through the File Explorer View of Eclipse Framework.
But strangely, I am not able to pull the file off the phone.
I have taken help of the link get the path of a Gallery Folder in Android for understanding the general view on Media Scanner.
I believe this is because the application doesn't know if there are images inside /data.
Try to put your images in:
/mnt/sdcard/Pictures

Thumbnail location of Images/Videos in sdcard

I would like to know the location of the stored thumbnails in android sdcard. I used the adb push service to upload images and videos to the sdcard. But even after deleting few images, my application is loading the thumbnails of the deleted images which is creating problems. When I click the thumbnails, instead of the corresponding image, some other image is opening. How to delete/ re-populate the thumbnails? Also How to load the original image of the clicked thumbnail? How does android retrieve the original image corresponding to its thumbnail? what's the mapping between these two?
Thanks in advance.
Well, if you are are using system intents, like ACTION_PICK, then you probably need run media scanner ( Applications > Dev Tools > Media Scanner )

Categories

Resources