开发者

Blackberry camera permission

One of the features incorporated in my app is QR code scanning. The problem is, user will be asked for camera permission before scanning. I think this could make the users confused.

Is there any way to bypass this, or something to set all the required permissions during installation, so users don't n开发者_运维知识库eed to set this manually?

I already heard about ApplicationPermissions, but still not sure how to use it.


You cannot set requested permissions in the JAD file as you can (I believe) in J2ME, but you can query the permissions which are set at runtime.

You are on the right track with ApplicationPermissions: when your app starts you would do something like this, for instance to request permission to access the file system:

ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
if(apm.getPermission(ApplicationPermissions.PERMISSION_FILE_API) != ApplicationPermissions.VALUE_ALLOW) {
    ApplicationPermissions ap = new ApplicationPermissions();
    ap.addPermission(ApplicationPermissions.FILE_API);
    apm.invokePermissionsRequest(ap);       
}


I found the Answer.

It is working with following code. And will not ask for permission when scanning QR code.

ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
        ApplicationPermissions ap = new ApplicationPermissions();
        ap.addPermission(ApplicationPermissions.PERMISSION_RECORDING);

        apm.invokePermissionsRequest(ap);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜