模块尝试访问安全API:RIM Blackberry

时间:2011-04-05 00:38:06

标签: blackberry code-signing blackberry-eclipse-plugin blackberry-jde

我在Eclipse中使用“Sign with Signature Tool”来签署我的应用程序。我看到签名者ID RRT,RBB和RCR都是为cod文件签名的(JRE版本4.5)。我尝试部署到5.0设备,我看到“模块尝试访问安全API”错误。

我错过了什么?

2 个答案:

答案 0 :(得分:1)

您是如何将其部署到设备的? 您应该考虑在cmdline中使用javaloader load myfile.cod或在eclipse中使用BlackBerry - Load Project(s) on device

答案 1 :(得分:0)

您的应用是否请求了所需的权限? 您需要类似下面的代码(在访问任何安全API之前运行它):

    int [] needed_permissions = {
            ApplicationPermissions.PERMISSION_INPUT_SIMULATION,
            ApplicationPermissions.PERMISSION_FILE_API,
            ApplicationPermissions.PERMISSION_ORGANIZER_DATA,
            ApplicationPermissions.PERMISSION_INTERNET,
            ApplicationPermissions.PERMISSION_LOCATION_DATA,
            ApplicationPermissions.PERMISSION_WIFI

    };

    public void checkPerm() {

         ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
         ApplicationPermissions original = apm.getApplicationPermissions();

         if(!permissionsPresent(apm, original))
             permissionsRequest(apm);

        application.pushScreen(new MainScreen());
    }

    private boolean permissionsPresent(ApplicationPermissionsManager apm, ApplicationPermissions original) {
        for(int i=0;i<needed_permissions.length;i++)
            if(original.getPermission( needed_permissions[i] ) != ApplicationPermissions.VALUE_ALLOW)
                return false;
        return true;
    }

    private void permissionsRequest(ApplicationPermissionsManager apm) {
        ApplicationPermissions permRequest = new ApplicationPermissions();
        for(int i=0;i<needed_permissions.length;i++)
            permRequest.addPermission( needed_permissions[i] );

        if(!apm.invokePermissionsRequest( permRequest )){
        Dialog.alert("Bad Perm!"); 
        System.exit(0);
    }   

}