码迷,mamicode.com
首页 > 移动开发 > 详细

Android6.0权限组申请

时间:2016-12-22 20:12:39      阅读:334      评论:0      收藏:0      [点我收藏+]

标签:class   roi   manifest   ext   oar   grant   sdk   color   pac   

 void checkPermission() {
        final List<String> permissionsList = new ArrayList<>();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            if ((checkSelfPermission(Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED))
                permissionsList.add(Manifest.permission.READ_PHONE_STATE);
            if ((checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED))
                permissionsList.add(Manifest.permission.WRITE_EXTERNAL_STORAGE);
            if (permissionsList.size() != 0) {
                requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),
                        REQUEST_PHONE_PERMISSIONS);
            }
        }
    }

 

Android6.0权限组申请

标签:class   roi   manifest   ext   oar   grant   sdk   color   pac   

原文地址:http://www.cnblogs.com/newcaoguo/p/6212419.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!