Sep 5, 2023, 2:18:23 AMSep 5
to Android CameraX Discussion Group, scot...@google.com, leoh...@google.com, Android CameraX Discussion Group, sanjuro ogawa, senior...@gmail.com
Thank you for all of your input.
It seems that I may need to write a bit of a wrapper around the whole "media saving" logic for pictures and movies.
Something such that if I could detect the current android version at runtime, branch to the appropriate code block.
So far, the requestLegacyExternalStorage setting to true under API 29 works.
As expected, API 30 did not work.
I tried to use leoh's solution and it worked, except that it ignored the full path that I had specifed, converted all of the "/" to "_", then saved the jpeg file in "Pictures" directly instead of saving it under "Pictures/MyPics" as I'd hoped.
So a filename would come out looking like this: "_storage_emulated_0_Pictures_MyPics_1693892355124.jpg".
Quite close. Perhaps it is because of the parameter MediaStore.MediaColumns.DISPLAY_NAME? Apart from that it saved a file every time.
I did try CameraX 1.3.0 rc01 and found that I needed to change the import for androidx.camera.core.VideoCapture to androidx.camera.video.VideoCapture as well as install API 34.
Again, I imagine that I would need to have to use some if-logic to make it so that things work reliably from API 24 (Nougat; Android 7.0) to present.
Thanks for all of the input. 😀
If it seems like I might have gotten sometthing wrong here, or if there are other ideas, please chime in and let me know.