开发者

Module attempts to access secure API: RIM Blackberry

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 d开发者_JAVA技巧eploy to a 5.0 device and I see the "Module attempts to access secure API" error.

What am I missing?


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


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

}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜