/wp-content/uploads/2013/12/sap_logo_333927.png

Appendix E:  Upgrading

The contents of the www folder such as the HTML, JavaScript, CSS and image files that make up a hybrid app can be easily updated via the AppUpdate plugin.  When it is time to upgrade the version of Cordova that the app was built with or the Kapsel plugins, the following instructions may be helpful.  The versions of Cordova that must be used with a given version of Kapsel are listed below.

Cordova 3.0.6/3.0.9 -> SMP SDK 3.0
Cordova 3.1.0-0.2.0 -> SMP SDK 3.0 SP01
Cordova 3.3.1-0.1.2 -> SMP SDK 3.0 SP02
Cordova 3.4.0-0.1.3 -> SMP SDK 3.0 SP03
Cordova 3.4.1-0.1.0 -> SMP SDK 3.0 SP04
Cordova 3.5.0-0.2.7 -> SMP SDK 3.0 SP05
Cordova 3.6.3-0.2.13 -> SMP SDK 3.0 SP06

The following steps demonstrate how to do an upgrade using the  StorageDemo project.  It will be upgraded from Cordova 3.5.0-0.2.7 to Cordova 3.6.3-0.2.13 and from SMP 3.0 SDK SP05 to SMP 3.0 SDK SP06 PL01.
Note, an alternative (and perhaps easier) approach to upgrading a project is to create a new project and then copy the HTML assets to the new project.

  • Create a backup of the project being upgraded.
  • Determine the version of Cordova that the project was created with.
    C:\Kapsel_Projects\StorageDemo>cordova platform
    Installed platforms: android 3.5.1
    Available platforms: amazon-fireos, blackberry10, firefoxos, windows8, wp8
  • Determine the version of the Cordova CLI currently installed.
    C:\Kapsel_Projects\StorageDemo>cordova -v
    3.5.0-0.2.7
    
  • Determine if there is a newer version of Cordova.
    C:\Kapsel_Projects\StorageDemo>npm info cordova
    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.1.0-0.2.0' },
      versions:
       [ '0.0.1',
         '0.0.2',
    ...
         '3.0.9': '2013-09-05T19:30:52.643Z',
    ...
         '3.1.0-0.2.0': '2013-10-29T18:38:39.703Z',
    ...
         '3.3.1-0.1.2': '2013-12-19T19:35:54.693Z',
    ...
         '3.4.1-0.1.0': '2014-04-09T22:09:03.857Z',
    ...
         '3.5.0-0.2.7': '2014-07-08T17:55:34.125Z',
    ...
         '3.6.3-0.2.13': '2014-09-18T20:37:08.180Z',
    
  •   

  • If needed, upgrade the Cordova version.      Since the Kapsel plugins have been tested against a specific version of the Cordova it is recommended that an install of a specific version is performed.
    npm uninstall -g cordova
    npm install -g cordova@3.6.3-0.2.13
    cordova -v
    3.6.3-0.2.13
    

    Note the version of node can also be checked.

    node -v
    v0.10.26

    The current version is listed and available at http://nodejs.org.

  • Upgrade the project.
    cordova -d platform update android
    or
    cordova -d platform update ios
    
    C:\Kapsel_Projects\StorageDemo>cordova platform
    Installed platforms: android 3.6.3
    

    Another way to see the version of a project is to examine the following file.

    C:\Kapsel_Projects\StorageDemo\platforms\android\assets\www\cordova.js
    var CORDOVA_JS_BUILD_LABEL = '3.6.3';
    

    For additional details on upgrading see the Cordova project see Upgrading Android and Upgrading iOS.

  • Determine the plugins used in the project by examining the plugins folder (C:\Kapsel_Projects\StorageDemo\plugins) or by using the plugins cli command.
    C:\Kapsel_Projects\StorageDemo>cordova plugins
    com.sap.mp.cordova.plugins.corelibs 3.5.0 "CoreLibs"
    com.sap.mp.cordova.plugins.encryptedstorage 3.5.0 "EncryptedStorage"
    com.sap.mp.cordova.plugins.logon 3.5.0 "Logon"
    org.apache.cordova.device 0.2.11 "Device"
    org.apache.cordova.inappbrowser 0.3.4-patched "InAppBrowser"
  • The versions of each plugin can also be determined by examining the version number in the plugin.xml. C:\Kapsel_Projects\StorageDemo\plugins\com.sap.mp.cordova.plugins.encryptedstorage\plugin.xml)
    <?xml version="1.0" encoding="UTF-8"?>
    <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="com.sap.mp.cordova.plugins.encryptedstorage" version="3.4.0">
        <name>EncryptedStorage</name>
    
    ...
    
    <?xml version="1.0" encoding="UTF-8"?>
    <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="org.apache.cordova.device" version="0.2.11">
        <name>Device</name>
    ...
        
  •   

  • Notice that the Kapsel plugins were created using 3.4.0.
    Download and run the installer to upgrade the SAP Mobile SDK to SP06 and SP05 for the server.  See Setup for additional details on where to download SP06 from.
  • Remove the old plugins.  Note that removing the encryptedstorage plugin should remove the corelibs plugin as it a dependent plugin.  A plugin’s dependencies are listed in its plugin.xml file.
    cordova plugin remove com.sap.mp.cordova.plugins.encryptedstorage
    cordova plugins

    if needed

    cordova plugins remove com.sap.mp.cordova.plugins.authproxy
    
  • In SDK SP04 the way that local plugins are found was changed.  When creating a new project a plugin_search_path parameter is passed.  This generates a file named config.json.  If upgrading a project that was created in SP03 or earlier, manually create this file and include the location where Kapsel SDK is installed.
    C:\Kapsel_Projects\StorageDemo\.cordova\config.json
    {
        "plugin_search_path": "C:/SAP/MobileSDK3/KapselSDK/plugins/"
    }
    

    or

    ~/Documents/Kapsel_Projects/StorageDemo/.cordova/config.json
    {
        "plugin_search_path": "/Users/i826567/SAP/MobileSDK3/KapselSDK/plugins/"
    }
    
  • Add the EncryptedStorage plugin.  Note that as of SP03 the EncryptedStorage plugin includes the Logon plugin.
    cordova -d plugin add com.sap.mp.cordova.plugins.encryptedstorage
    
  • Examine the list of plugins in the project
    C:\Kapsel_Projects\StorageDemo>cordova plugins
    com.sap.mp.cordova.plugins.authproxy 3.6.3 "AuthProxy"
    com.sap.mp.cordova.plugins.corelibs 3.6.3 "CoreLibs"
    com.sap.mp.cordova.plugins.encryptedstorage 3.6.3 "EncryptedStorage"
    com.sap.mp.cordova.plugins.logon 3.6.3 "Logon"
    org.apache.cordova.device 0.2.13 "Device"
    org.apache.cordova.inappbrowser 0.3.4-patched "InAppBrowser"
    
  • Verify the plugins are now updated by examining the list above.
    Note that the device plugin is being accessed from https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git, so the latest version available of the plugin is added at the time the command is run.  To see the version history of the plugin, see its git hub page at https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git.
  • Prepare the project.
    cordova -d prepare
    
  • As a final step remember to upgrade the Kapsel CLI.
    C:\SAP\MobileSDK3\KapselSDK\cli>npm uninstall -g kapsel
    C:\SAP\MobileSDK3\KapselSDK\cli>npm install -g
  • The following links contain some information regarding the latest news on Cordova including new releases.
    Cordova News
    Cordova Blog
  • Note there are some known Cordova issues with uninstalling plugins.  CB-6140

Back to Getting Started With Kapsel

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

    1. Estanislao Bulian

      Hi Daniel,

        Excelent series of blogs. Where can we find the relation between versions of cordova and SMP that is updated directly from SAP?. I’m currently on latest versions of SDK SP8PL2 and Server SP7PL3.

      (0) 
      1. Estanislao Bulian

        To keep up-to-date.

        SAP Mobile Platform SDK 3.0 SP07 npm install -g cordova@4.2.0

        SAP Mobile Platform SDK 3.0 SP08 npm install -g cordova@4.2.0

        Thanks,

        (0) 

Leave a Reply