Upgrading the PhoneGap Library Used by the BlackBerry Hybrid Web Container

SAP Mobile Platform includes the Cordova (PhoneGap) 2.0 libraries. Follow these steps if you want to upgrade the BlackBerry Hybrid Web Container to a more recent version of the Cordova library.

This procedure describes upgrading the Cordova library from version 2.0.0 to version 2.9.0. The steps to upgrade to other versions differ slightly. Since the Hybrid Web Container template project does not include the source code for building HybridAppLib.jar, the ability to upgrade Cordova to newer versions is limited, and certain new Cordova features may not work properly in Hybrid Web Container project.
Note: Upgrading the Hybrid Web Container container to use Cordova 3.0.0 is not supported because the Hybrid Web Container project does not work with Cordova 3.0.0 CLI.
  1. Download phonegap 2.9.0 from phonegap.com, and unzip it to a local folder.
  2. After unziping the phonegap2.9.0 zip file, go into the \blackberry\bbos\framework\ext foloder, and import the project to Eclipse blackberry plugin to compile/package the source code. The Cordova.jar can be found under the deliverables directory, in your project.
  3. Open Eclipse and import the HWC template project.
  4. Expand the HWC template project, and delete the PhoneGapExtension.jar file from the libs folder. Copy the cordova.jar file built above and copy it to the libs folder.
  5. Right-click the Hybrid Web Container project and click the Properties menu. Select Java Build Path > Libraries . Select the PhoneGapExtension.jar file, then remove the old jar file.
  6. Select Add JARs… and expand the HybridWebContainer\libs node. Select the new cordova-2.9.0.jar file, and click OK to confirm the selection.
  7. Right-click the Hybrid Web Container project and click the Properties menu. Select Java Build Path > Order and Export . Select the checkbox for Cordova.jar and OK to close the “Properties” dialog.
  8. Update the com.sybase.hwc.amp.HWCBrowserFieldListener.java class, since the constructor of class CordovaExtension was changed in 2.9.0.

    Open the com.sybase.hwc.amp.HWCBrowserFieldListener.java class and make this change:.

    *************line 323**************
    if( extension instanceof CordovaExtension )
    {    
       extension = new CordovaExtension(getClass().getResourceAsStream("/xml/plugins.xml"));
    }
    
    Change to:
    
    if( extension instanceof CordovaExtension )
    {    
       extension = new CordovaExtension();
    }
    
    ****************************
    
  9. Update the com.sybase.hwc.amp.HWCWidgetConfigImpl.java class:
    **********line 175*********************
    widgetExtensions.addElement( new CordovaExtension(this.getClass().getResourceAsStream("/xml/plugins.xml")) );
    Change to:
    widgetExtensions.addElement( new CordovaExtension() );
    
    ***************************************
    
  10. Clean the HWC project and have Eclipse build the HWC project.
  11. If the cordova.js file is used in your HybridApp.js app, you must also update cordova.js to the one provided with the new cordova library.