requestPermissions() do not show dialog with Allow or Deny choise on some Xiaomi devices

93 views Asked by At

Good day. A few users with xiaomi devices on 12 and 13 Android complaning that the app do not invoke the system dialog with choise to give access to WRITE_EXTERNAL_STORAGE. The most of all users get that dialog without problem. But some with Xiaomi on 12 or 13 Android get that problem. Offcourse right line is present in Manifest file(it is working on the most of devices):

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

I invoke that dialog like this:

requestPermissions(context, arrayOf(WRITE_EXTERNAL_STORAGE),777)

I got one this device with this problem at my collegue. There is no even setting where I should be able to switch the radiobutton between Allow and Deny in system settings - Applications - MY_APP - Permissions - Files and Mediacontent - Allow or Deny. May be someone faced with same problem or know how it resolves. Thanks.

I tried to detect what condition of access in the internal storage on that devices when the dialog should be invoked. Offcourse it is deny. But I do not understand why I can't make a choise via that dialog or even in system settings.

1

There are 1 answers

0
Termit___ On

I have resolved this problem via removing those lines in Manifest and removing request permissions function in a code. Because:

On Android 4.4 (API level 19) or higher, your app doesn't need to request any storage-related permissions to access app-specific directories within external storage.

It is working well without any requests. You may just act with File(read, write, delete) class free. The system (from API 19 and higher) make the space for an app in external storage without any restrictions. =))