Method of permission dispatcher in Android 6.0 permission dynamic application framework

1. Add dependency

Add in the build.gradle file of project

Add in build.gradle of module

2. Add notes

Note description

Runtimepermissions: a required comment to comment on the activity or fragment to obtain permission

Needspermission: a required annotation used to annotate the method that needs to obtain permission

Onshowrational: an optional comment that prompts the user why to enable this permission. It is called when the user needs access permission after refusing

Onpermissiondenied: non mandatory comment, prompt when the user chooses to reject

Onneveraskagain: non mandatory comments. Prompt after the user chooses not to ask again

Access to the call: from the new compiler will generate auxiliary class xxxPermissionsDispatcher, through the xxxPermissionsDispatcher.xxxWithCheck method to call, at the same time rewrite the onRequestPermissionsResult method, in which the onRequestPermissionsResult onRequestPermissionsResult method, return the access permission results.

The above method of permission dispatcher, an Android 6.0 permission dynamic application framework, is all the content shared by Xiaobian. I hope it can give you a reference and support more programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>