Saved images not immediately visible in Photos app - android

I'm writing a (230 kb) jpeg file to the location returned by
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getAbsolutePath()
Which on my 8.9 Kindle Fire HD is /mnt/sdcard/Pictures and I can see browsing the filesystem via eclipse that the image is saved pretty much instantly and all appears to be well. However when I open the Photos app, there is no sign of the image and it takes a variable amount of time (up to several minutes) for it to appear.
My assumption is that the Photos app checks for new pictures on a timer, is that the case? Is there any way I can notify it of a new image?
I've tried saving to other locations but that doesn't seem to have any impact.
I'm targeting 2nd gen and HD Kindle Fire devices only.

I had a similar problem on a regular Android tablet (so not sure if the Gallery on the Samsung is the same as Photos on the Kindle) but this forced a refresh without waiting or plugging in USB
sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse(
"file://"+Environment.getExternalStorageDirectory())));
I will try and confirm that it works on the Kindle Fire HD over the weekend

Related

expo-image-picker android error with content:// uri

Installed expo-image-picker, calling launchImageLibraryAsync. This works completely fine on Emulator.
On a real android device (Samsung A3, API 24), and picking images from the Library, I sometimes get an error Uri lacks 'file' scheme: content://com.android.provider.media.documents/documents/<imagename..>.
My understanding is that it's images which have been saved NOT by the device camera, e.g. whatsapp, other apps using the camera. Images which were taken on the device camera work OK and have a local path.
Is there a known way to deal with this? I can't seem to stop the user seeing/picking these images, and can't pass in any options to ignore this error (or fail gracefully if multiple images are selected and only 1 fails). Currently we just catch and give a generic error which is a bit mmm.

Saving image picked from gallery

I tried this. Perfect work on almost devices.
But doesn't work at Samsung Galaxy 3.
On normal device i have something like content://media/external/images/media/1 in intent.getData() and after using getContentResolver() i have /mnt/sdcard/Android/data/package/.../file.jpg
But on Samsung Galaxy 3 in intent.getData() i have content://com.sec.android.gallery3d.provider/picasa/item/5624862738518543714 and https://lh5.googleusercontent.com/-22xcQIWrlT4/Tg-G29-6jWI/AAAAAAAAAJA/i_FUO3pN1Sc/I/%2525D0%252597%2525D0%2525B0_%2525D0%2525B5%2525D0%2525B4%2525D1%252583.jpg after using Resolver.
What should i do to get normal path on Samsung Galaxy 3?
UPD: i see, in gallery there is available to pick pictures from my Google+ shared pictures. Hm...
So, i think, i will show message for users in this case to pick only local files.

setRotation() does not work on Samsung devices; Solution without having to save the image to the phone

Okay so here's a problem I have.
setRotation() should rotate a captured JPEG image. It works fine on most phones, but somehow doesn't work on Samsung Galaxy S3 and S4.
Here's a question with a proposed soluton:
setRotation(90) to take picture in portrait mode does not work on samsung devices
It involves manipulating the EXIF data, however, the ExifInterface() being used, requires the image to be saved to the phone, and then it uses the absolute file path.
However, I don't want to save the image to the phone, that's one of my main criteria. Any idea, on how to go about this issue?

My code to capture a video from the default camera works fine on every device except the Galaxy S2 when specifying MediaStore.EXTRA_OUTPUT path

I have code that gives me back a path to store my video file which basically produces a path that looks like this:
/storage/sdcard0/Pictures/MyApp/MyApp20130816_144111_1131938614.mp4
When I try to capture the video on my S2, I take the video and press stop the camera my camera app does not display the normal save screen, it just puts itself back into the beginning of capture mode and onActivityResult is never called. I've found that if I do not pass a path to MediaStore.EXTRA_OUTPUT it functions correctly.
I've tested my code on Note II, GS3, GS4, Nexus and they all seem to be able to capture the video and save it to the correct path with no problems. Why would the S2 be behaving this way?
Something about the galaxy s2 doesn't like /storage/ maybe?
Never hardcode paths. Always use methods like Environment.getExternalStoragePublicDirectory() to get the root of where to store files on external storage. Different devices, and even different users on the same device (Android 4.2+ tablets) will have different paths for external storage.
However, the point in my initial comment still holds. You as a developer are not "using the default camera app as installed on the galaxy devices". You as a user may be using that particular app. There are nearly a billion Android device users; you are not all of them. They are welcome to use whatever camera app they want to, including third-party ones. And, they will be using thousands of Android device models. None of them will necessarily honor your request to take a picture. It's certainly worthwhile for you to do testing to try to work more faithfully on more devices (such as not hardcoding paths), but you need to bear in mind that any time you ask another developer's app to do work for you, the other developer is control of what happens, much more than you are.

Images not visible on Galaxy S3

I hava the following issue - my app is working well on all devices I have, but I have just tried it on Galaxy S3 and I am surprised to see, that all images are... gone. The only image, that is still visible, is the app icon image. On the S3 I have downloaded the app from th market.. and as mentioned - on the other devices it works as expected. The images are statically loaded in xml in image views... nothing fancy...
Any idea what could cause such behavior?
This is the app id in market, if needed (NOT intended to be app advertisement!):
Com.rts.android.tictactoe3d
Thank you!
This was a wired issue, it dissipated after I have updated my S3 to the latest firmware. Before that nothing really helped, I have tried to cleanup the application data, uninstall/reinstall, more the app to the SD or back to phone - same behavior.
It turned out, that GIF image format is not entirely supported in some Android versions, for more information you could take a look at the thread below and a big THANK YOU to Rich for solving the issue!
Images not loading on Galaxy S3

Categories

Resources