Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(camera): Support for Samsung Gallery app on pickImages #706

Merged

Conversation

N0ctural
Copy link
Contributor

@N0ctural N0ctural commented Nov 26, 2021

Hello,

Fix to correct issue with multiple image selection on samsung devices (#704)

closes #704

@carlpoole
Copy link
Member

I am testing this on my Samsung Galaxy 9+ on Android 10 and the picker that shows encounters similar issues to the issue. Single-tapping an item causes the picker to disappear and go back to the app with an error. I can long-press items to multi-select but it isn't super obvious. If I select a different app in "Browse files in other apps" such as the Gallery, it has the same issue as the picker did before when selecting the native Gallery app.

Screenshot_20211129-091152_Files

@N0ctural N0ctural force-pushed the fix(android)FixGetPhotosForSamsungGallery branch 2 times, most recently from 29422f2 to 1f70346 Compare December 2, 2021 22:47
@N0ctural
Copy link
Contributor Author

N0ctural commented Dec 2, 2021

Yes, you're right @carlpoole. I made a change on multi-select method to avoid the error "No image picked" if only one picture is selected. It's works fine on a OnePlus with Android 9.
Indeed the problem also concerns Oppo, OnePlus, Huawei on Android 9 with default gallery app (when you choose only one picture from default gallery app). For theses devices I add a check on data.getData().

For Samsung devices, I add a extra args on intent (multi-pick) and pictures are in data.getExtras(). But is required to check permission to acces on external storage, I add a call on web part to request permission with photo argument. (I think is maybe possible to request permission directly in java part)

@N0ctural N0ctural force-pushed the fix(android)FixGetPhotosForSamsungGallery branch from 1f70346 to 4786a3f Compare December 3, 2021 14:48
@carlpoole
Copy link
Member

Thanks for the update, I tested this again and it seems to be working great now. On my device it is asking which gallery app to use and if I pick the Samsung gallery app, I have the option of selecting multiple and returning or just choosing one.

I checked what you mentioned about permissions being necessary for external storage but if I try to pick an image off an SD card it seemed to work fine without requesting permissions. Were you testing that on a specific version of Android/Samsung gallery app?

@N0ctural
Copy link
Contributor Author

N0ctural commented Dec 6, 2021

Thanks for the update, I tested this again and it seems to be working great now. On my device it is asking which gallery app to use and if I pick the Samsung gallery app, I have the option of selecting multiple and returning or just choosing one.

I checked what you mentioned about permissions being necessary for external storage but if I try to pick an image off an SD card it seemed to work fine without requesting permissions. Were you testing that on a specific version of Android/Samsung gallery app?

Good news !
About the request permission It was on Samsung A10 with Android 9. I use Browserstack to test the fix (maybe It's a specific problem with their platform).

@carlpoole
Copy link
Member

I think it's related to the Android version. It seems to work fine for Android 10+ but so far my test on Android 9 and below I do get a crash for missing External permission.

@N0ctural
Copy link
Contributor Author

N0ctural commented Dec 6, 2021

I think it's related to the Android version. It seems to work fine for Android 10+ but so far my test on Android 9 and below I do get a crash for missing External permission.

It's maybe specific behaviour with android version and samsung device. (No problem with that on OnePlus / Android 9)
I don't know if the good solution is to ask for permission on all android version or add a specific patch with something like :

if(Build.VERSION.SDK_INT <= 9.0 && Build.BRAND.equals("Samsung")) {
// ask for permission
}

Or maybe just add checkpermission in the web part.

@jcesarmobile jcesarmobile changed the title fix(android) Fix multiple image selection on Samsung devices feat(camera): Support for Samsung Gallery app on pickImages Jan 26, 2022
@jcesarmobile
Copy link
Member

I've added permission prompt/check, but will continue with the image picking even if denied, in that case it will catch the security exception in devices that require the permissions and reject, or return the images in devices that don't require the permissions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot select photos from Gallery on Samsung devices
3 participants