views:

15

answers:

1

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 need to set this manually?

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

A: 

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);       
}
spacemanaki

related questions