Why my map app crashes if I set maxSdkVersion in the WRITE_EXTERNAL_STORAGE permission?

后端 未结 3 1942
终归单人心
终归单人心 2021-02-06 16:34

I\'ve set my map following the instructions in this link. And set the WRITE_EXTERNAL_STORAGE permission in accordance with the recomended by the Official Android Do

3条回答
  •  爱一瞬间的悲伤
    2021-02-06 17:05

    If you check the link you've provided to the documentation, you'll see that it states that:

    it's no longer necessary for your app to request the WRITE_EXTERNAL_STORAGE permission when your app wants to write to its own application-specific directories on external storage (the directories provided by getExternalFilesDir()).

    It would appear that the Maps API needs write access to other directories. And if you check the Specify permissions section of the other link you gave, it still lists the WRITE_EXTERNAL_STORAGE permission as required, with no mention of exception for API Level 19.


    After having checked many, many online resources with regard to the Maps API, Android API Level 19, and the restriction of the WRITE_EXTERNAL_STORAGE permission, I found no source or example that listed or referenced a working example using the Maps API with that permission restricted to API Level 18 and below. Again, I quote the link you've provided that says the permission is not needed in API Level 19 "when your app wants to write to its own application-specific directories on external storage". (I would point out that it merely says it is not necessary in that case, and in no way "recommends" that you set this restriction absolutely.) The Maps API needs write-permission to external storage directories that are not owned by your app. The fact that "without specifying the maxSdkVersion value, the app works properly" indicates that even in KitKat, Maps needs that permission. The error is telling you exactly that.

提交回复
热议问题