Blackberry 从我的黑莓应用程序打开shazam

Blackberry 从我的黑莓应用程序打开shazam,blackberry,blackberry-eclipse-plugin,blackberry-jde,shazam,Blackberry,Blackberry Eclipse Plugin,Blackberry Jde,Shazam,如果安装了shazam(手机中的其他内置应用程序),我需要打开该代码。 我如何检查手机中是否安装了shazam,如果安装了,我如何从我的应用程序中打开它?如果有人有想法,请帮助。感谢advace public static ApplicationDescriptor getApplicationDescriptor(String appName) { try { int[] moduleHandles = CodeModuleManager.getModuleHandle

如果安装了shazam(手机中的其他内置应用程序),我需要打开该代码。 我如何检查手机中是否安装了shazam,如果安装了,我如何从我的应用程序中打开它?如果有人有想法,请帮助。感谢advace

public static ApplicationDescriptor getApplicationDescriptor(String appName) {
    try {
        int[] moduleHandles = CodeModuleManager.getModuleHandles();
        if (moduleHandles != null && moduleHandles.length > 0) {
            for (int i = 0; i < moduleHandles.length; i++) {
                ApplicationDescriptor[] applicationDescriptors = CodeModuleManager.getApplicationDescriptors(moduleHandles[i]);
                if (applicationDescriptors != null && applicationDescriptors.length > 0) {
                    for (int j = 0; j < applicationDescriptors.length; j++) {
                        if (applicationDescriptors[j].getModuleName().toLowerCase().equals(appName.toLowerCase())) {
                            return applicationDescriptors[j];
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        System.out.println("error at getApplicationDescriptor" + e);
    }
    return null;
}

public static int runApplication(String appName) {
    int processId = -1;
    ApplicationDescriptor appDescriptor = getApplicationDescriptor(appName);
    if (appDescriptor != null) {
        //is not null Application installed
        processId = ApplicationManager.getApplicationManager().getProcessId(appDescriptor);
        if (processId == -1) {
            // -1 if application has no process (i.e. is not running).
            try {
                processId = ApplicationManager.getApplicationManager().runApplication(appDescriptor);
            } catch (ApplicationManagerException e) {
                e.printStackTrace();
            }
        }
    }
    return processId;
}
int pid=-1;
    if((pid=runApplication(appName))>-1){
            //application running
            System.out.println(appName +" runing with process id "+pid);
        }