Skip to Content
Author's profile photo Jan Schober

Howto deploy and configure a KAPSEL app with SAP Afaria


Howto deploy and configure a KAPSEL app with SAP Afaria


This guide describes how create a KAPSEL app for Android, which retrieves data through SMP3 from an OData service. The app will be deployed and configured through SAP Afaria SP03, so the user only has to enter his backend credentials.

Configure SMP Application

First you have to configure an SMP Application in SMP’s Admin cockpit. In case you need more info then the brief steps mentioned here, go to infocenter.

  • In SMP Admin Cockpit, create a new application
    Screen Shot 2014-01-16 at 12.58.54.png
  • Define the Application ID
    Screen Shot 2014-01-16 at 12.59.42.png
  • Configure backend endpoint to point towards an OData service
    (Note: for you to be able to redo this work without having to setup an OData service yourself, you are going to use’s Northwind service. Although it does not have authentication enabled, you can still use this url for your authentication, all username/passwords will be accepted. This will obviously different in a real world scenario).
    Screen Shot 2014-01-16 at 13.00.05.png
  • Configure http authentication to authenticate against the same Service
    Screen Shot 2014-01-16 at 13.16.39.png
    Screen Shot 2014-01-16 at 13.16.52.png
    Screen Shot 2014-01-16 at 13.17.04.png

Now your SMP3 server is ready to accept requests, authenticate and route them to the OData service.

Prepare the KAPSEL app

Next thing you’ll have to do is prepare the KAPSEL application.

Note: If you want to know more about what KAPSEL is and how to use it together with Cordova, see infocenter. Additionally a series of Getting Started documents is available to help you get going.

You are going to use the KAPSEL Logon plugin, which will allow automatic configuration using Afaria and ease up the onboarding of your application to SMP3.

The basic steps that you have to execute from the commandline are mentioned here. If you want to learn more about the Logon Plugin, see the Getting Started Guide.

  • Create a Cordova project
  • Add android platform
  • Add KAPSEL Logon Plugin
  • Exchange index.html in www folder with sample_index.html (see attachment to this doc)
  • Prepare the KAPSEL project
    Screen Shot 2014-01-16 at 13.21.46.png
  • Then import the project into Eclipse with ADT installed

Package and sign the application

As you want to deploy the application through Afaria, we nee to prepare an APK-file. Therefore you need to compile and sign your application.

  • Export the project as Android Application
    Screen Shot 2014-01-16 at 13.23.47.pngScreen Shot 2014-01-16 at 13.23.57.png
  • Create a new keystore to store the signing key you are about to generate
    Screen Shot 2014-01-16 at 13.24.29.png
  • Create the key by giving all the details required
    Screen Shot 2014-01-16 at 13.25.04.png
  • Save the signed APK somewhere, so you can pick it up from the Afaria Console
    Screen Shot 2014-01-16 at 13.25.19.png

Configure Afaria

So your KAPSEL application is all setup to work against the already configured SMP3 server. Now you are going to configure the Afaria server to deploy the app and send the connection settings along with it to your device.

Note: As a prerequisite to deploy applications through Afaria, you have to enroll your device. More info on how to do this, can be found here

  • Open the Afaria Admin in your favorite browser and create a new Android Enterprise Application Policy
    Screen Shot 2014-01-16 at 13.27.05.png
  • Give it a name
    Screen Shot 2014-01-16 at 13.27.46.png
  • Upload the APK you just created
    Screen Shot 2014-01-16 at 13.28.20.png
  • Add some description, if you want to
    Screen Shot 2014-01-16 at 13.28.58.png
  • In the configuration section, you are hitting a critical point. So you upload a config file holding content like this (obviously adjusted with your environment’s details):
    Screen Shot 2014-01-16 at 13.30.01.png;serverport=443;ishttps=true;companyid=0;securityconfig=BASIC;usercreationpolicy=automatic;

    Screen Shot 2014-01-22 at 10.53.45 AM.png
    Note: It has to be a configuration text file, typing text into the box won’t work. Some of the settings mentioned in this settings string are not applicable to all environments. Please refer to the MAF documentation to get all the available settings.

  • Now link the policy to the Android Group and you should see the app in your Afaria client after refreshing on the device
    Screen Shot 2014-01-16 at 13.30.56.png

Install the app using the Afaria client

  • On the device open the Afaria client and connect it.
  • You’ll see the Application listed on the Enterprise App Screen
  • Click on the app to see the details and hit the install button to download and start the installation.
  • When the app has been installed, open it.

Run the app

  • When opening the app, the LogonManager pops up. Note that it is only asking for the backend username and password. All the other settings (servername etc) have been pulled using the config file deployed together with the app.
  • Enter username and password
  • Specify an application passcode
  • Enter the app
  • You can test if the connection to the backend through SMP works, by fetching the Service Document or the Collection


This Howto Guide showed the steps necessary to configure, build, deploy and run a KAPSEL application with the help of SAP Afaria with just a couple of steps.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member


      A clear document to understand step by step process for deploying the application from Afaria.

      Nice work.

      Author's profile photo Midhun VP
      Midhun VP

      Thanks for this updated information Jan. We are eagerly waiting for SMP 3 release, to test the system. Any updates on this ?

      - Midhun VP

      Author's profile photo Virinchy P
      Virinchy P

      Thanks Jan , for a nice a good step by step document to deploy Kapsel application with Afaria.

      Author's profile photo Jitendra Kansal
      Jitendra Kansal

      Fantastic stuff.

      Nicely written with self explanatory screenshots. Thanks for sharing.



      Author's profile photo Former Member
      Former Member

      Hi Jan,

      We are attaching, the configuration file to the application through Afaria, butwhen we open it on a device, it is unable to fetch registration details like servername, port , etc.

      We are using relay server for SMP server.

      Please find below screenshot of config file.



      Any ideas on what we are doing wrong?



      Author's profile photo Daniel Van Leeuwen
      Daniel Van Leeuwen

      Can you provide some additional details on the versions of the software being used. 

      SMP 3.0 SDK version

      Afaria version

      SMP 3.0 Server version

      iOS version


      Dan van Leeuwen

      Author's profile photo Former Member
      Former Member

      Software versions are:

      SMP 3.0 SDK version : 3 SP 06

      Afaria version : 7 SP 05

      SMP 3.0 Server version : 3 SP 05

      Android version : 5.0.2