Android Q: file.mkdirs() returns false

前端 未结 2 568
清歌不尽
清歌不尽 2020-12-03 10:20

We have an app that uses external storage to store some temporary files: images, binary data. The code for that has been working for a few years without big changes until re

2条回答
  •  遥遥无期
    2020-12-03 10:53

    There was huge privacy change in android Q by introducing Scoped Storage.

    Since Q beta 4 it's possible to opt-out of that feature by:

    • targeting API 28 (or lower)
    • using requestLegacyExternalStorage manifest attribute (while targetting API 29):

    
      
      
        ...
      
    
    

    edit: as mentioned in other answer this does not work if app is targeting API 30 - Android 11 devices will ignore legacy storage flag.

提交回复
热议问题