Environment.getExternalStorageDirectory() deprecation alternatives

后端 未结 2 1973
醉话见心
醉话见心 2021-02-14 08:55

In SDK 29 (Aka Android_Q), The access to external storage using the method Environment.getExternalStorageDirectory() is deprecated and no longer returns an accessib

2条回答
  •  抹茶落季
    2021-02-14 09:13

    You can use the flag android:requestLegacyExternalStorage="true" in your manifest file.

    This attribute is "false" by default on apps targeting Android 10 or higher.

    However, in future versions of Android, this permission will not be available.

    For next Android versions we should use scoped storage. More info here

提交回复
热议问题