Android M request permission non activity

前端 未结 6 1985
渐次进展
渐次进展 2020-12-11 14:38

My widget makes calls to secure permissions outside of an Activity scope. Is it possible to request permissions for Android M outside of an

6条回答
  •  长情又很酷
    2020-12-11 15:02

    You could use the Easy Permissions library.

    Android requires that these request come from an Activity. With Easy Permissions this is no longer an issue, you may request permission from anywhere as long as you provide Context. In addition, if you request a permission that is already granted the user will not be prompted.

    Full disclosure, our company manages and develops this free to use library. That being said, we are confident that it is a useful tool and we would not share it otherwise.

提交回复
热议问题