Module attempts to access secure API: RIM Blackber

2019-06-13 18:47发布

I used the "Sign with Signature Tool" in Eclipse to sign my app. I see that signer ids RRT, RBB and RCR are all signed for the cod files (JRE version 4.5). I try to deploy to a 5.0 device and I see the "Module attempts to access secure API" error.

What am I missing?

2条回答
姐就是有狂的资本
2楼-- · 2019-06-13 19:30

Did your app request the needed permissions? You'll need something like the code below (run it before accessing any secure APIs):

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

}
查看更多
聊天终结者
3楼-- · 2019-06-13 19:46

How did you deploy it to device? You should consider using javaloader load myfile.cod in cmdline or BlackBerry-Load Project(s) on device in eclipse

查看更多
登录 后发表回答