Including a Prepackaged Hybrid App in the BlackBerry Hybrid Web Container

Run a prepackaged so that the Hybrid Web Container functions as a single-purpose application rather than a general purpose one.

Prerequisites
Install the BlackBerry Java Plug-in for Eclipse.
Task

  1. Package the Hybrid App files.
    You can use a Hybrid App that was generated with the Hybrid App Designer, or you can use the packaging tool to generate a new Hybrid App.
    When packaging the Hybrid App, optimize the size by generating a version for each specific platform that includes only files for that platform.
    See Packaging Hybrid Apps Using the Packaging Tool.
  2. In Eclipse, import the BlackBerry Hybrid Web Container template as a legacy BlackBerry project:
    1. Select File > Import.
    2. Expand the BlackBerry folder.
    3. Select  Import Legacy BlackBerry Projects.
    4. Click  Next.
    5. Specify the JRE and, in the BlackBerry Workspace field, browse to the HWCtemplate.jdw file and select the project to import.
    6. Select Copy BlackBerry projects into workspace to create a copy of the imported project in the Eclipse workspace.
    7. Click Finish.
  3. Copy the generated Hybrid App folder under the package tool workspace to the res directory of the imported Eclipse BlackBerry Hybrid Web Container project.
  4. Remove the ZIP file from the folder, and refresh the Eclipse workspace.
  5. Open the the CustomizationHelper.java file for editing.
  6. Find the BLACKBERRY_CUSTOMIZATION_POINT_PREPACKAGE_APP that accompanies the getPrepackagedAppPath function, and change the contents of the function to return the name of the top-level directory you just added to the project.

    If the prepackaged Hybrid App manages the server connection by itself and wants to exit the Hybrid Web Container after exiting the prepackaged Hybrid App, change return value of the method exitHWCOnPrepackagedAppClose to true.

  7. Save the CustomizationHelper.java file.