How to get Access to External Storage in Android 10 (Android Q)?

后端 未结 2 1199

I just migrated my sourcecode to Androidx, since I did that my share function to share a sound is no longer working. the Logcat says:

Failed to save file: /s         


        
2条回答
  •  独厮守ぢ
    2020-12-11 21:14

    I have been stuck for a long time and this worked fine for me

      StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
        StrictMode.setVmPolicy(builder.build());
        File = new File(filepath);
    

    and don't forget to request legacy Storage in manifest file.

      
    

提交回复
热议问题