Invalid Redmi Note 10 Pro - MIUI 12.5.6 / Android 11 - ContentChooser doesnt work properly


artsoft

Members
Jan 10, 2022
2
3
Hi Folks!

I am a software developer for Android apps and I am currently faced with some strange issues regarding the use of the so called "ContentChooser" (Intent.createChooser).

My MIUI version is currently global 12.5.6 / Android version is 11 RKQ1.200826.002.

2 Issues:

1. When I try to call the file chooser with ...

Java:
Intent in = new Intent(Intent.ACTION_GET_CONTENT);

in.setType(Mime);
in.addCategory(Intent.CATEGORY_OPENABLE);
in = Intent.createChooser(in, Title);

... then the smartphone only provides a file list from internal storage (and external storage in case of an additional SD card).

The smartphone doesnt provide the possibility to select a file via other methods like: google drive, one drive, other installed file managers and so on!

2. When I disabled the so called "MIUI Optimizations" within the devleoper settings, then I can see the additional possibilties and I can select the files also in google drive, one drive and so on. But first I have to confirm a big warning from smartphone: Disabling these optimizations can make the smartphone unusable. So this is not a good solution. But perhaps it can help to detect the error.

BUT in this case 2:
I cannot (!) read the file, because the intent object returns always RESULT_CANCELED instead of RESULT_OK. That means that the value of the directoy and the file (which are needed to read the file) is always empty (or better: NULL).

For me these are heavy bugs
and no one can actually work with my app in this case.

Can anybody help here please.
It is very urgent.

Thanks in advance and best regards
ARTsoft