react-native-documents / document-picker

Document Picker for React Native
https://react-native-documents.github.io/
MIT License
1.33k stars 434 forks source link

[Android 13, 14]: DocumentPicker throws an error [Error: User canceled document picker] #694

Open aviktius opened 6 months ago

aviktius commented 6 months ago

Bug report

Summary

DocumentPicker throws an error [Error: User canceled document picker] on Android 13 and 14. I found the same issue that has been fixed here which works perfectly with the latest version of the library (including Android 12) but fails on Android 13 and 14 with the same error.

Reproducible sample code

The issue is reproducible on Android devices with 13 and 14 versions of OS.

Steps to reproduce

  1. Update your Android device to the latest OS version (14)
  2. Update the document picker starting from version 8.1.4 (8.1.3 is the last working version in this case)
  3. Pick a file
  4. Get an error

Describe what you expected to happen:

  1. Document picker loads file(s)

Environment info

Android version: 14.0

aviktius commented 2 months ago

any updates on that?

vonovak commented 2 months ago

Hello and thanks for asking, I now focus on improving the package for sponsors. I wrote an automated test suite for that package using Appium, and you can see an example recording here.

The tests were executed on real devices including Android 13 and 14 and didn't encounter the issue you're reporting.

Not a direct answer, but it is an update 🙂 Thank you

TwistedMinda commented 2 months ago

Same issue here.

Drop-in replacement expo-document-picker did the trick for me, just works.

aviktius commented 2 months ago

Drop-in replacement expo-document-picker did the trick for me, just works.

Thanks, works well for me either

vonovak commented 2 months ago

Hi, Just so I understand the original report: @aviktius are you saying that with Intent.createChooser, it worked for you on Android 14 (but not 12), and without Intent.createChooser it works on Android 12 but not 14?

The difference with expo's picker is that it uses Action.open_document, but this package uses Action.get_content.

You can use Action.open_document with the package for sponsors, see open mode.

Also see the differences in the ui for both intent types:

https://react-native-documents.github.io/docs/sponsor-only/picker/integrating-on-android