Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
Dan_vL
Product and Topic Expert
Product and Topic Expert
0 Kudos
1,011

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 5.1.1 should be used if using SMP 3.0 SP09 SDK.

The following steps demonstrate how to do an upgrade using the  StorageDemo project.  It will be upgraded from Cordova 4.2.0 to Cordova 5.1.1 and from SMP 3.0 SDK SP08 to SMP 3.0 SDK SP09 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 versions of Cordova platforms included in the project.
    C:\Kapsel_Projects\StorageDemo>cordova platform
    Installed platforms: android 3.6.4
    Available platforms: amazon-fireos, blackberry10, firefoxos, windows8, wp8
  • Determine the version of the Cordova CLI currently installed.
    C:\Kapsel_Projects\StorageDemo>cordova -v
    4.2.0
  • 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:    [ ...      '4.2.0': '2015-01-07T01:40:14.886Z',      '4.3.0': '2015-02-27T21:15:21.509Z',      '5.0.0': '2015-04-16T20:16:51.255Z',      '5.1.0': '2015-05-27T23:54:43.677Z',      '4.3.1': '2015-06-02T15:57:11.472Z',      '5.1.1': '2015-06-09T21:21:46.301Z' 
  •     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@5.1.1
    cordova -v
    5.1.1
    Note the version of node can also be checked.
    node -v
    v0.10.38
    The current version is listed and available at http://nodejs.org.

  • Upgrade the project.
    cordova platform update android
    or
    cordova platform update ios

    C:\Kapsel_Projects\StorageDemo>cordova platform
    Installed platforms: android 4.0.2
    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 PLATFORM_VERSION_BUILD_LABEL = '4.0.2';
    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.authproxy 3.8.1 "AuthProxy"
    com.sap.mp.cordova.plugins.corelibs 3.8.1 "CoreLibs"
    com.sap.mp.cordova.plugins.encryptedstorage 3.8.1 "EncryptedStorage"
    com.sap.mp.cordova.plugins.logon 3.8.1 "Logon"
    org.apache.cordova.device 0.3.0 "Device"
    org.apache.cordova.inappbrowser 0.6.0-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.8.1">    <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.3.0">    <name>Device</name> ...    
  • Notice that the Kapsel plugins were created using 3.8.1.
    Download and run the installer to upgrade the SAP Mobile SDK to SP09 and SP08 for the server.  See Setup for additional details on where to download SP09 from.

  • Remove the old plugins.  Note that removing the encryptedstorage plugin should remove the logon and corelibs plugin as they are dependent plugin.  A plugin's dependencies are listed in its plugin.xml file.
    cordova plugin remove com.sap.mp.cordova.plugins.encryptedstorage
    cordova plugins
  • Add the SP09 version of the EncryptedStorage plugin.  Note that in SP09 the plugin ID's of the Kapsel plugins have been changed to follow the new Cordova plugin ID format.
    cordova plugin add kapsel-plugin-encryptedstorage --searchpath %KAPSEL_HOME%/plugins
  • Add the new Whitelist plugin or the legacy whitelist plugin.
    cordova plugin add cordova-plugin-whitelist
    or
    cordova plugin add cordova-plugin-legacy-whitelist
  • Examine the list of plugins in the project
    C:\Kapsel_Projects\StorageDemo>cordova plugins
    cordova-plugin-device 1.0.1 "Device"
    cordova-plugin-whitelist 1.0.0 "Whitelist"
    kapsel-plugin-authproxy 3.9.1 "AuthProxy"
    kapsel-plugin-corelibs 3.9.1 "CoreLibs"
    kapsel-plugin-encryptedstorage 3.9.1 "EncryptedStorage"
    kapsel-plugin-inappbrowser 0.6.0-patched "InAppBrowser"
    kapsel-plugin-logon 3.9.1 "Logon"
    Note that the device plugin version history can be seen at https://github.com/apache/cordova-plugin-device/releases.

  • Prepare, build and deploy the app with the following command.
    cordova run android
    or
    cordova run ios
  • 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

Back to Getting Started With Kapsel