Android6.0动态获取权限
作者:
张汉 | 来源:发表于
2016-07-15 10:37 被阅读0次 if (Build.VERSION.SDK_INT >= 23) {
int checkBlueoothPermission = ContextCompat.checkSelfPermission(mContext,Manifest.permission.ACCESS_FINE_LOCATION);
if(checkBlueoothPermission != PackageManager.PERMISSION_GRANTED){
//无权限申请权限
//申请权限可以使数组,一次申请多个权限
ActivityCompat.requestPermissions((Activity) mContext, new String[]{
Manifest.permission.ACCESS_FINE_LOCATION,Manifest.permission.ACCESS_COARSE_LOCATION},1);
return;
}else{
//执行需要调用的方法
}
} else {
//执行需要调用的方法
}
本文标题:Android6.0动态获取权限
本文链接:https://www.haomeiwen.com/subject/egryjttx.html
网友评论