How to give blackberry application all the availab

2019-06-24 07:49发布

问题:

I'm developing using JDE 4.5 which doesn't contain the PERMISSION_RECORDING, and it's denied by default in 4.6 and higher devices.

So I want my application to have this permission or all the possible permissions that it can get.

Thanks in advance.

回答1:

You can't set app permissions pro grammatically. What you can do is force Request Permission dialog to appear, see How to - Display custom messages in the request permission dialog

So what you can do is do some test recording on application startup, then Request Permission dialog will come up. It would come up anyway, but on startup this will be more in place, and more, you can set your own message text there.

UPDATE
If permission is set to Deny than there will be no Promt Dialog on denied action.
Then you can use ApplicationPermissionManager to invoke permission request:

ApplicationPermissionsManager manager = ApplicationPermissionsManager
    .getInstance();
int current = manager
    .getPermission(ApplicationPermissions.PERMISSION_SCREEN_CAPTURE);
if (current != ApplicationPermissions.VALUE_ALLOW) {
    ApplicationPermissions permissions = new ApplicationPermissions();
    permissions.addPermission(ApplicationPermissions.PERMISSION_SCREEN_CAPTURE);
    manager.invokePermissionsRequest(permissions);
}