kivy / plyer

Plyer is a platform-independent Python wrapper for platform-dependent APIs
https://plyer.readthedocs.io
MIT License
1.56k stars 424 forks source link

Choose a reasonable and valid number for the intent code #790

Open matan-h opened 6 months ago

matan-h commented 6 months ago

This PR makes the Android file chooser use a reasonable and valid number in the intent code. As this Stack Overflow post explains, the maximum value for the requestCode is 2^16 (65536).

Previously, the code used arbitrary numbers (123456 and 654321), which is making some phones encounter a Java Exception: java.lang.IllegalArgumentException: Can only use lower 16 bits for requestCode.

Julian-O commented 6 months ago

I am not 100% sure I understand the context on this code, so let me explain what I think:

My comments:

matan-h commented 6 months ago

Thank you, @Julian-O. I've added an explanation to the code and edited the description of this pull request to make it cleaner.

I've also removed the other minor change as that would probably require a design change. Here is the android code which creating this error in the new API:

Julian-O commented 6 months ago

Thanks. I understand now.

[Just to be clear, I am not an official reviewer with merge rights. We'll need to wait for one of them.]