An Easy way to Stage your Mobile Apps in HANA Cloud Platform mobile services

SAP’s mobile solution on cloud is called HANA Cloud Platform mobile services (HCPms). One of the striking feature added to it is Staging.

What is Staging ?

Staging helps the developers to give their application to the users for testing, after the completion of the tests it could be moved immediately to the end users from admin cockpit itself. Hence initially the application will be staged in the HCPms before moving it to production.

Here I am explaining how you could do it using the trial version of HCPms.

Configure Application in Cockpit
  • Open HCPms admin cockpit, then click on Applications.
  • Click on Configure and provide below details.

stage1-1stage2 (1)

Note: Backend URL – http://services.odata.org/V2/OData/OData.svc

  • Click on Save.
Create a Kapsel Application

The following steps will create a simple Kapsel app with an AppUpdate plugin.

  • Cordova command to create project
       cordova -d create C:\Kapsel_Projects\StagingDemo com.sap.staging StagingDemo "{\"plugin_search_path\":\"C:/SAP/MobileSDK3/KapselSDK/plugins/\"}"
       cd C:\Kapsel_Projects\StagingDemo
       cordova -d platform add android
       cordova -d create ~/Documents/Kapsel_Projects/StagingDemo com.sap.staging StagingDemo "{\"plugin_search_path\":\"/Users/i12345/SAP/MobileSDK3/KapselSDK/plugins/\"}"
       cd ~/Documents/Kapsel_Projects/StagingDemo
       cordova -d platform add ios
  • Replace index.html (C:\Kapsel_Projects\StageDemo\www\index.html) with this sample code. This is an extended code from these kapsel guides.
  • Add AppUpdate plugin and logon plugin
      cordova -d plugin add com.sap.mp.cordova.plugins.appupdate
      cordova -d plugin add com.sap.mp.cordova.plugins.logon
  • Run the following command to build project.
      cordova build
  • Run app in emulator using the below command.
      cordova emulate android
      cordova emulate ios
  • Login to the application. The credentials doesn’t matter since we configured the app with No Authentication. The application will show a list of products.                                                                                  stage0 (1)
  • From HCPms Admin Home page click on Registrations and Users > Turn on “Is Tester” button. Hence this user gets the applications which are under stage state.stage3 (1)
Enable Staging

In this step we are going to upload a new version of the Kapsel application to HCPms for testing (Stage state).

  • When we run the app for the second time to identify the a change, update index.html file as given below. This will get the list of Suppliers instead of Products.stage9 (1)
  • Build the app

              cordova build

  • The Kapsel command line provides a way to create a zip file that could to uploaded to HCPms. Open a command prompt and change path to
      C:\SAP\MobileSDK3\KapselSDK\cli
      ~/SAP/MobileSDK3/KapselSDK/cli
  • Run command
      npm install -g

For Mac:

      sudo npm -g install
  • Open command prompt and change the path to your Kapsel project (C:\Kapsel_Projects\StagingDemo) and execute the command
      kapsel package

stage52

  • Now you could find a zipped file created inside your project folder.stage10 (1)
  • Next step is to upload the zipped file to HCPms. To upload the file open HCPms home page then click on Applications > Choose your application > Configure > App specific settings. Then click on UploadKapsel and browse the zipped file.stage6 (1)
  • Choose the application uploaded, then click on Stage. It moves the application to stage state. Which will be accessible to the users who are testers.stage11 (1)
Test App on Emulator or Device

Now, when we close and reopen the app the AppUpdate plugin identifies that there is an updated app in the server. It gives a pop up for relaunching the app to download the changed files from server.

  • Choose Relaunch Now. You could see that the list is changed from Products to Suppliers.              stage7 (1)              stage12 (1)

After testing the application, from admin cockpit choose the application under Stage state, then click on Deploy, which will make the application available for users in production.

After testing the application, from admin cockpit choose the application under Stage state, then click on Deploy, which will make the application available for users in production.

1 thought on “An Easy way to Stage your Mobile Apps in HANA Cloud Platform mobile services”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.