Upgrading Kapsel Applications

Follow these steps to upgrade your Kapsel plugins to use a specific version of Cordova.

Prerequisites
Task

Kapsel plugins are compiled for a specific version of the Cordova framework. As subsequent versions of Cordova are released, the Kapsel plugins must be tested, updated (if necessary), and built for release, against the updated Cordova version. This means that you cannot immediately use new Cordova versions for Kapsel applications—you must wait for the compatible version of Kapsel to be released before building Kapsel applications using the updated version of Cordova.

For example, the initial version of Kapsel supported Cordova 3.0 and Cordova command line interface 3.0.9, so you could use only Cordova 3.0 with the initial version of Kapsel. SAP Mobile Platform SP01 adds support for Cordova 3.1. SP02 adds support for Cordova 3.3.

Note: Do not use a version of Cordova that is not compatible with the current version of the Kapsel SDK. If you upgrade your project to an incompatible version of Cordova, the Kapsel plugins may still install, but the application will not build properly and may not run on a mobile device or emulator.

All of the commands in this procedure are performed in a terminal window on Mac, or a Windows command prompt window, in the Cordova project directory. If you have more than one Cordova project to upgrade, you must perform the same steps in each Cordova project directory.

  1. To determine which version of Cordova the project was created with, navigate to the directory that contains your Cordova project and enter:
    cordova platform
    For example:

    C:\Kapsel_Projects\StorageDemo>cordova platform

    You see something similar to:
    Installed platforms: android 3.0.9
    This example shows that Cordova 3.0.9 is installed for the Android platform.
  2. Determine which version of the Cordova command line interface is installed by entering:
    cordova -v
  3. See if there is a newer version of Cordova by entering:
    npm info cordova
    You see output similar to this:
    npm http GET https://registry.npmjs.org/cordova
    npm http 304 https://registry.npmjs.org/cordova
    
    { name: 'cordova',
      description: 'Cordova command line interface tool',
      'dist-tags': { latest: '3.3.1-0.1.2' },
      versions:
       [ '0.0.1',
         '0.0.2',
    ...
        '3.0.6',
        '3.0.7',    
        '3.0.8',
        '3.0.9',
        '3.0.10',
        '3.1.0-0.1.0',
        '3.1.0-0.2.0',
        '3.3.1-0.1.2' ], 
  4. Upgrade to the specified Cordova version by entering:
    On Windows: npm install -g cordova@<version_to_upgrade_to>
    On Mac: sudo npm install -g cordova@<version_to_upgrade_to>
    For example, on Windows, to upgrade from Cordova 3.1.0 to version 3.3.1, enter:
    npm install -g cordova@3.3.1-0.1.2
  5. Upgrade the Cordova project by entering:
    For Android cordova -d platform update android

    For iOS cordova -d platform update ios

    The -d flag indicates debug output and is optional.

  6. To see what plugins you have installed, navigate to the Kapsel project folder, and enter:
    cordova plugins
    You see a list of the plugins included with the application, for example:
     ['com.sap.mp.cordova.plugins.appupdate',    
    'com.sap.mp.cordova.plugins.authproxy',    
    'com.sap.mp.cordova.plugins.corelibs',    
    'com.sap.mp.cordova.plugins.encryptedstorage',    
    'com.sap.mp.cordova.plugins.i18n',    
    'com.sap.mp.cordova.plugins.logger',    
    'com.sap.mp.cordova.plugins.logon',    
    'com.sap.mp.cordova.plugins.push',    
    'com.sap.mp.cordova.plugins.settings',    
    'org.apache.cordova.console',    
    'org.apache.cordova.device',    
    'org.apache.cordova.device-orientation',    
    'org.apache.cordova.dialogs',    
    'org.apache.cordova.inappbrowser' ] 
    In the above example, you see that both Kapsel and Cordova Core plugins appear. This is because some of the Kapsel plugins rely on some of the Cordova Core APIs.
  7. Uninstall each of the Kapsel plugins you have installed by entering:
    cordova plugin remove <plugin_id>
    Where <plugin_id> refers to the ID for the particular plugin. For example, to uninstall the Logon plugin, you would enter:
    cordova plugin remove com.sap.mp.cordova.plugins.logon
    Repeat this step for each Kapsel plugin, changing the plugin ID as needed, according to the plugin you are removing.
    Note: Since some of the Kapsel plugins depend on several of the Cordova plugins and those Cordova plugins may have been updated with each new release of Cordova, the dependent Cordova plugins must also be removed from the project before you reinstall the Kapsel plugins. Beginning with Cordova command line interface 3.1, dependent plugins should be removed when all plugins that rely upon them are removed, so when you complete these steps, both the Kapsel and associated, dependent Cordova Core API plugins should be removed from the project. However, testing has proven that this is not always the case. If, after removing all of the Kapsel plugins, you execute the cordova plugins command from a terminal window, you may see remnant plugins left in the project as shown in the example below.
  8. For iOS, when removing plugins, common frameworks may be removed. To allow the upgraded project to be successfully built, you can either again add the frameworks to the Xcode project, or recreate the project.

    In the Xcode project, you can add these frameworks:

    • CFNetwork.framework
    • SystemConfiguration.framework
    • AudioToolbox.framework

    Alternatively, you can recreate your project from scratch and copy over the www folder.

  9. Add the Kapsel plugins back to the project by entering:
    cordova plugin add <path_to_Kapsel_plugin>
    For example, to add the AppUpdate plugin, enter:

    On Windows:

    cordova -d plugin add <SDK_HOME>\MobileSDK3\KapselSDK\plugins\appupdate

    On Mac:

    cordova -d plugin add ~<SDK_HOME>/MobileSDK3/KapselSDK/plugins/appupdate

    Note: The path you enter to the Kapsel plugin must be the absolute path (not relative path).
  10. Prepare the Cordova project by entering:

    cordova -d prepare android

    or

    cordova -d prepare ios

  11. Upgrade the Kapsel command line interface by entering:
    SDK_HOME\MobileSDK3\KapselSDK\cli>npm uninstall -g kapsel
    SDK_HOME\MobileSDK3\KapselSDK\cli>npm install -g