定位权限是否开启

应用判定定位权限是否开启

PackageManager pkm = getPackageManager();
        boolean has_permission = (PackageManager.PERMISSION_GRANTED == pkm.checkPermission("android.permission.ACCESS_FINE_LOCATION", "YourPackagename"));
        if (has_permission) {
            log.e("TAG","定位权限已开启");
        }else{
            log.e("TAG","定位权限被禁用!!!");
        }

你可能感兴趣的:(安卓基础)