Reputation: 119
I want to use ACTION_OPEN_DOCUMENT on my Xiaomi Device. I tried this google sample, but it also not working. With code below i can normally run on Samsung galaxy s4.
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
startActivityForResult(intent, 42);
Im getting "android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.OPEN_DOCUMENT_TREE }" error.
Upvotes: 6
Views: 2199
Reputation: 624
I saw the same error occur on Xiaomi MI 6X with Android 10.
Upon some digging I realized that some devices allow the user to disable the "Files" app from Google Play Services (or might even do that by default). Thus, I would recommend first prompting user for enabling "Files" app and/or updating the Google Play Services. Please note, that on most devices the "Files" app is hidden from the user, thus it will not be present on app list in preferences.
Upvotes: 3
Reputation: 1006944
Xiaomi screwed up, apparently. AFAIK, they're not Google Play certified, so they do not need to pass the CTS. There is nothing you can really do about it, other than to detect this case (e.g., use PackageManager
and queryIntentActivities()
, or catch the ActivityNotFoundException
) and fall back to whatever you do on pre-Android 4.4 devices.
Upvotes: 7