After updating to Android 11 MIUI 12.5.2 Global Intent
result is buggy and returning RESULT_CANCELED
when selecting image file. We thought it was part of Android 11 breaking changes but testing it on Android 12 has no issue. Now we are having issue on same device as well using image cropping library. It seems this only occurs in MIUI with Android 11 and there's currently no clear solution.

- 2,858
- 4
- 24
- 67
1 Answers
One solution that works, but is not sustainable, is this:
Just go to Settings -> Additional Settings -> Developer Option -> Turn on MIUI optimization (enable it) Note - If not see the option "Turn on MIUI optimization" then click "Reset to default values" 4-5 times. It will enable the option.
Source: https://github.com/rnmods/react-native-document-picker/issues/440#issuecomment-897352982
On my side I noticed that the problem was caused by the Intent.createChooser
.
So I replaced it with an ActivityResultContracts.GetMultipleContents()
and now it works also on Xiaomi with Android 11 !
GetMultipleContents()
because I was using Intent.EXTRA_ALLOW_MULTIPLE
. But otherwise you can use ActivityResultContracts.GetContent()
.
Code: https://github.com/Infomaniak/android-kDrive/pull/891/files

- 486
- 7
- 10