PassAndroid icon indicating copy to clipboard operation
PassAndroid copied to clipboard

Migrate image picker to new Photo Picker (Android 13 compatibility)

Open z3ntu opened this issue 1 year ago • 7 comments

With Android 13 the previous photo picker didn't trigger at all anymore. But we can use the new Photo Picker UI as described in [0] to get a new and better photo picker. Some refactoring is necessary to suport that.

[0] https://android-developers.googleblog.com/2023/04/photo-picker-everywhere.html

Fixes #477


NOTE: I haven't tested this extensively, just a bit on an Android 13 virtual device in Android Studio but everything seems to work there. Before merging (or basing something on this) please test this also on older devices, I don't know how much is available there of this photo picker. Maybe it needs some runtime if.

It's also been a while since I properly did some development for Android so some code could be a bit weird.

z3ntu avatar Aug 26 '23 14:08 z3ntu

Any updates on this? Being unable to select files from storage kinda breaks the whole app for Android 13 users.

je-sendra avatar Dec 10 '23 22:12 je-sendra

Thanks & sorry for the late review. Tested it on a recent (API 34) and an older device (API 31) and it also works. Need to make some more tests and my mind up as it increases the minSDK . so I need to see that I leave the ppl with the set of devices that I leave out in a good state.

ligi avatar Dec 15 '23 03:12 ligi

It does increase minsdk? At least in git diff there's no change in manifest or is this through some other reason?

z3ntu avatar Dec 15 '23 06:12 z3ntu

I have been using the app compiled from this branch and it seems to work just fine

je-sendra avatar Dec 15 '23 13:12 je-sendra

@z3ntu : https://developer.android.com/reference/androidx/activity/result/contract/ActivityResultContracts.PickVisualMedia

@je-sendra what API level?

ligi avatar Dec 15 '23 14:12 ligi

Right, minSdk is currently 14, and PickVisualMedia is 19+. But not sure anyone really is still using an Android version lower than 4.4 KitKat, but I get what you mean. If you really want to continue supporting API 14-18, then you could really add some if for runtime that it chooses an older code path I think.

z3ntu avatar Dec 15 '23 15:12 z3ntu

Currently sdk level 19 support is at 99.8% of the devices, and Google Play services dropped support for API levels below 21 in August 2023 according to https://apilevels.com/.

BBazard avatar Jun 10 '24 16:06 BBazard