【ブラックベリー】権限申請
1363 ワード
Blackberryブートシステム権限ページ申請権限os 5,6,7の下で適用
public class PermissionApply {
private static int[] permissions = {
ApplicationPermissions.PERMISSION_FILE_API,
ApplicationPermissions.PERMISSION_RECORDING};
/**
*
*
*/
public static boolean couldCapture(int permission) {
ApplicationPermissions apm = ApplicationPermissionsManager
.getInstance().getApplicationPermissions();
return apm.getPermission(permission) == ApplicationPermissions.VALUE_ALLOW;
}
/**
*
* @Title: setupPermissions
* @Description: , ( )
* @return boolean true: ,false:
* @throws
*/
public static boolean setupPermissions() {
ApplicationPermissionsManager man = ApplicationPermissionsManager
.getInstance();
ApplicationPermissions perms = new ApplicationPermissions();
boolean change = false;
for (int i = 0; i < permissions.length; i++) {
if (man.getPermission(permissions[i]) != ApplicationPermissions.VALUE_ALLOW) {
change = true;
perms.addPermission(permissions[i]);
}
}
if (change) {
return man.invokePermissionsRequest(perms);
} else {
return true;
}
}
}