When to request permission at runtime for Android Marshmallow 6.0?

后端 未结 11 984
故里飘歌
故里飘歌 2020-12-06 05:54

I am testing my app on Marshmallow 6.0 and it\'s getting force closed for the android.permission.READ_EXTERNAL_STORAGE, even if it is defined in th

11条回答
  •  既然无缘
    2020-12-06 06:24

    In general, request needed permissions it as soon as you need them. This way you can inform the user why you need the permission and handle permission denies much easier.

    Think of scenarios where the user revokes the permission while your app runs: If you request it at startup and never check it later this could lead to unexpected behaviour or exceptions.

提交回复
热议问题