Package net.rim.device.api.applicationcontrol

Examples of net.rim.device.api.applicationcontrol.ApplicationPermissions


          scriptEngine.addExtension(feature, BarcodeNamespace.getInstance());
        }
     
      if( feature.equals( BarcodeNamespace.FEATURE_NAME ) ) {
            ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
            ApplicationPermissions permissions = apm.getApplicationPermissions();
            ApplicationPermissions newPermissions = new ApplicationPermissions();

            int permissionKeys[] = new int[] { ApplicationPermissions.PERMISSION_FILE_API, ApplicationPermissions.PERMISSION_INPUT_SIMULATION, ApplicationPermissions.PERMISSION_MEDIA, ApplicationPermissions.PERMISSION_RECORDING };

            for( int i = 0; i < permissionKeys.length; i++ ) {
                int key = permissionKeys[ i ];
                if( permissions.getPermission( key ) != ApplicationPermissions.VALUE_ALLOW ) {
                    newPermissions.addPermission( key );
                }
            }

            if( newPermissions.getPermissionKeys().length > 0 ) {
                boolean accept = ApplicationPermissionsManager.getInstance().invokePermissionsRequest( newPermissions );
                if( !accept )
                    throw new Exception( "Could not load blackberry.media.camera" );
              
               
View Full Code Here


            throws Exception {
        Object obj = null;

        if( feature.equals( CameraNamespace.NAME ) ) {
            ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
            ApplicationPermissions permissions = apm.getApplicationPermissions();
            ApplicationPermissions newPermissions = new ApplicationPermissions();

            int permissionKeys[] = new int[] { ApplicationPermissions.PERMISSION_INPUT_SIMULATION,
                    ApplicationPermissions.PERMISSION_EVENT_INJECTOR, ApplicationPermissions.PERMISSION_FILE_API };

            for( int i = 0; i < permissionKeys.length; i++ ) {
                int key = permissionKeys[ i ];
                if( permissions.getPermission( key ) != ApplicationPermissions.VALUE_ALLOW ) {
                    newPermissions.addPermission( key );
                }
            }

            if( newPermissions.getPermissionKeys().length > 0 ) {
                boolean accept = ApplicationPermissionsManager.getInstance().invokePermissionsRequest( newPermissions );
                if( !accept )
                    throw new Exception( "Could not load blackberry.media.camera" );
            }
View Full Code Here

            throws Exception {
        Object obj = null;

        if( feature.equals( MicrophoneNamespace.NAME ) ) {
            ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
            ApplicationPermissions permissions = apm.getApplicationPermissions();
            ApplicationPermissions newPermissions = new ApplicationPermissions();

            int permissionKeys[] = new int[] { ApplicationPermissions.PERMISSION_FILE_API };

            for( int i = 0; i < permissionKeys.length; i++ ) {
                int key = permissionKeys[ i ];
                if( permissions.getPermission( key ) != ApplicationPermissions.VALUE_ALLOW ) {
                    newPermissions.addPermission( key );
                }
            }

            if( newPermissions.getPermissionKeys().length > 0 ) {
                boolean accept = ApplicationPermissionsManager.getInstance().invokePermissionsRequest( newPermissions );
                if( !accept )
                    throw new Exception( "Could not load blackberry.media.camera" );
            }
View Full Code Here

        // Capture the current state of permissions and check against the
        // requirements
        final ApplicationPermissionsManager apm =
                ApplicationPermissionsManager.getInstance();
        final ApplicationPermissions original = apm.getApplicationPermissions();

        // Set up and attach a reason provider
        final DemoReasonProvider drp = new DemoReasonProvider();
        apm.addReasonProvider(ApplicationDescriptor
                .currentApplicationDescriptor(), drp);

        if (original
                .getPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION) == ApplicationPermissions.VALUE_ALLOW
                && original
                        .getPermission(ApplicationPermissions.PERMISSION_PHONE) == ApplicationPermissions.VALUE_ALLOW
                && original
                        .getPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS) == ApplicationPermissions.VALUE_ALLOW
                && original
                        .getPermission(ApplicationPermissions.PERMISSION_EMAIL) == ApplicationPermissions.VALUE_ALLOW) {
            // All of the necessary permissions are currently available
            return;
        }

        // Create a permission request for each of the permissions your
        // application
        // needs. Note that you do not want to list all of the possible
        // permission
        // values since that provides little value for the application or the
        // user.
        // Please only request the permissions needed for your application.
        final ApplicationPermissions permRequest = new ApplicationPermissions();
        permRequest
                .addPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_PHONE);
        permRequest
                .addPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS);
        permRequest.addPermission(ApplicationPermissions.PERMISSION_EMAIL);

        final boolean acceptance =
                ApplicationPermissionsManager.getInstance()
                        .invokePermissionsRequest(permRequest);
View Full Code Here

TOP

Related Classes of net.rim.device.api.applicationcontrol.ApplicationPermissions

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.