Android Q (10) ask permission to get access all storage. Scoped storage

后端 未结 3 583
自闭症患者
自闭症患者 2020-12-10 02:03

In Android 10 apps that need to access storage need to ask permission to access a concrete path. But apps like file explorer can ask permission for access to the root storag

相关标签:
3条回答
  • 2020-12-10 02:38

    in Android Q If you giving permission and its granted or not working so go to Manifest and add

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:requestLegacyExternalStorage="true" //Add this Line
        android:label="@string/app_name">
    
    ---------<Activity, Sevices or Recivers>----------
    
    </application>
    
    0 讨论(0)
  • 2020-12-10 02:55

    you must add this line in your AndroidManifest.xml

    android:requestLegacyExternalStorage="true"
    
    0 讨论(0)
  • 2020-12-10 02:57

    The problem was that I use File object to access files, but permission only work if we use DocumentFile object to manipulate files.

    Solved using DocumentFile instead of File.

    It has multiple negative points to use DocumentFile, such as performance and that you don't have access to apache commons libraries for example, but there is no other option.

    0 讨论(0)
提交回复
热议问题