简体   繁体   中英

blackberry app download issue

我正在用Blackberry构建AppWorld之类的东西。我里面有类别,子类别和应用程序。我想进行应用程序内下载,但截至目前,我正在调用浏览器并传递url,然后进行内容下载。像黑莓AppWorld一样,如何进行应用内下载或从我的应用内下载。

您需要使用代码模块管理器API来下载和安装应用程序。

Code in bits and pieces

                      _moduleGroup = new CodeModuleGroup(appVendorName);
                    _moduleGroup.setVersion(JADParser.getValue("MIDlet-Version"));
                    _moduleGroup.setVendor(vendorName);
                    _moduleGroup.setFriendlyName(appName);
                    _moduleGroup.setDescription(JADParser.getValue("MIDlet-Description"));
                    String dependency = JADParser.getValue("RIM-COD-Module-Dependencies");
                    if (dependency != null)
                    {
                            dependency = dependency.trim();
                            String[] dependencyList = vStringUtils.split(dependency, ',');
                            for (int i = 0; i < dependencyList.length; i++)
                            {
                                    _moduleGroup.addDependency(dependencyList[i]);
                            }
                    }
        for (i = 0; i < count; i++)
        {
            if (!writeCODFile(getCodFileData(i), getCodFileName(i)))
            {
                throw new Exception();
            }
        }
    private boolean writeCODFile(byte[] data, String fileName)
    {
            boolean isSuccess = true;
            int moduleId = 0;
            if (data.length > MODULE_SIZE_LIMIT)
            {
                    moduleId = CodeModuleManager.createNewModule(data.length, data, MODULE_SIZE_LIMIT);
                    isSuccess = CodeModuleManager.writeNewModule(moduleId, MODULE_SIZE_LIMIT, data, MODULE_SIZE_LIMIT, data.length - MODULE_SIZE_LIMIT);
            }
            else
            {
                    moduleId = CodeModuleManager.createNewModule(data.length, data, data.length);
            }
            if (moduleId > 0 && isSuccess)
            {
                    int ret = CodeModuleManager.saveNewModule(moduleId, true, _transactionId);


                    if (ret == CodeModuleManager.CMM_OK_MODULE_OVERWRITTEN || ret == CodeModuleManager.CMM_OK)
                    {
                            return true;
                    }

            }
            return false;
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM