views:

366

answers:

1

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  A: 

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);
}
Max Gontar
The recording permission is denied by default so there's no prompt appear in using the recording API.
Ali El-sayed Ali
You right. see update.
Max Gontar
Thanks for your update, but the problem is the constant that represent the recording (PERMISSION_RECORDING) doesn't exist in JDE 4.5.When I looked at JDE 4.6 documentation I saw that the PERMISSION_SCREEN_CAPTURE is seprecated. As of 4.6, replaced by PERMISSION_RECORDING.SO in JDE 4.5 the permission that represent the recording is PERMISSION_SCREEN_CAPTURE, so I used it to allow recording voice and it's working.
Ali El-sayed Ali
You're welcome! updated per your comments.
Max Gontar

related questions