Skip to Content

Getting Started with Kapsel – Part 4 — Push



Push messages provide a way to inform or remind a user that an action should be taken by delivering a short message that appears as a notification on the device.  When clicked on, the app that is associated with the message is opened.  The Kapsel push plugin provides an abstraction layer over the Google Cloud Messaging for Android (GCM) and Apple Push Notification Service (APNS).  A notification can be sent to a device registered with an application via a REST call to


The REST call should either contain a header named X-SMP-DATA or X-SMP-GCM-DATA which includes values for the title and message content to be displayed or the values can be included in the URL.

Note, for SMP servers that are on a network that use a proxy ensure that the proxy settings are set for the SMP server under Settings > System > HTTP Proxy Settings so that the SMP server can access the GCM and APNS servers.
Note, if you have proxy setting set and are not on a network that uses a proxy, the proxy settings should be removed or the host for the GCM or APNS server should be added to the non-proxy hosts field.

Note that both GCM and APNS require open ports that may be blocked on some corporate networks or routers.  GCM uses ports between 5228 and 5230.  APNS uses the ports described here.

For additional details see the JavaScript file in a project that includes this plugin at


or the JS Documentation at Kapsel Push API Reference.

The following steps will demonstrate this plugin using Google Cloud Messaging.  Note, it requires either an Android device or an Android emulator that targets the Google API’s.

The process for iOS and Windows is covered by others.  Here are a few posts to check out. 
Apple Push Notification Services in iOS 6
[Kapsel] How to use the Push plugin on iOS
[Kapsel] How to use the Push plugin on Windows

  • Follow the instructions at Getting Started with GCM to create an API project, receive a project number (sender ID), enable the GCM service for the project and to obtain an API key.
  • Follow the steps shown in Configuring a Kapsel App in the Management Cockpitto create an Application with the application id of

      This app does not use an OData endpoint so the endpoint can be set to a dummy URL such as

    and add the Basic SSO mechanism and the default security provider.

  • Fill in the Push settings for the application. 
  • Edit the Notification security provider and add a System Login (Admin Only) authentication provider.  Set the user name and password to a value like smpPushUser and smpPushPwd and the role Notification User.  Note this user name and password will need to be entered later when we send a notification to the device using the Advanced REST client.

    Restart the SMP 3.0 server.

  • Create the project.
    cordova -d create C:\Kapsel_Projects\PushDemo com.mycompany.push PushDemo "{\"plugin_search_path\":\"C:/SAP/MobileSDK3/KapselSDK/plugins/\"}"
    cd PushDemo
    cordova -d platform add android
  • Add push plugin.
    cordova -d plugin add
  • Replace www\index.html with index.html.
    Update index.html and enter the serverHost(line 15) and sender ID(line 62).
  • Copy the files to the platform directory by running
    cordova -d prepare
  • Use the Android IDE to open the project.
  • Open the Android SDK Manager click on the Obsolete checkbox and download Extras >Google Cloud Messaging for Android Library (Obsolete)
  • Copy the below jar into the libs folder of the PushDemo project.
  • Use the Android IDE to deploy and run the project.
  • Click on the Register For Push button

    Note that when reopening the app, the Register For Push button must be pressed again or in a non-sample app, it should be called in the logonSuccessCallback method which would be called each time the application starts.

  • Send a REST request to send a notification to a Kapsel app.  The registration id can be copied from Management Cockpit. 

    For additional details on the headers see Notification Data Sent Through HTTP Headers and as of SMP Server SP04 Notification Data Sent Using Push API.

    The below are a few different ways to send a notification.

    X-SMP-DATA: {"alert":"New Vacation Approval Request", "dispmsg":"For (i826565) request ID[7]"}
    X-SMP-GCM-DATA: {"alert":"New Vacation Approval Request", "dispmsg":"For (i826565) request (7)"}
    x-sap-poke-title: New Vacation Approval Request
    x-sap-poke-data: {"dispmsg":"For (i826565) request (7)"} Vacation Approval Request&data={"dispmsg":"For (i826567) request (7)"}

    When prompted for a User Name and Password enter smpPushUser and smpPushPwd.


    The following are a few examples using the new restnotification API.
    {"alert":"New Vacation Approval Request", "data":"For (i826565) request (7)" }

    {"alert":"New Vacation Approval Request", "data":"For (i826565) request (7)" }

    {"alert":"New Vacation Approval Request", "data":"For (i826565) request (7)" }

    Note, the first example may not work if the forward slash is missing from the end of the URL. 
    An example using the Advance REST Client

    An example using Postman.

    When prompted for a User Name and Password enter smpPushUser and smpPushPwd.

    If the status is 403, this indicates a permission problem.  Double check that that the correct user id and password for the Notification security profile were correctly entered.  Also double check that the correct role name of Notification User was assigned to the Roles of the authentication provider for the Notification security profile.

    If the status is 404, this may indicate that the app did not successfully register for notifications.  Try pressing the Register for Push button again and verify that the Successfully registered alert displays.

    If the status is 200, this may indicate that the app has not registered and received a registration id from Google or perhaps that there is some issue reaching the Google GCM service.  Double check that the sender ID was added to the index.html.

  • The notification will be processed by the app if it is running in the foreground.
  • Now press the back button to exit the app and send the notification again from the Advanced Rest Client.  The notification should appear on the device or simulator and clicking on it will open the app.  Notice that a custom icon was used by replacing the file


    If the app is not in the foreground when a notification arrives, the details of the notification can be accessed by calling sap.Push.checkForNotification(processMissedNotification).

    Note the notification shown will be for the notification that was selected from the notification bar.

    Also note that it may appear as the Kapsel app is opened multiple times after selecting a notification from the notification bar when the app is in the foreground due to issue 162504

  • A logcat filter using the log tag value of PUSH will filter out the messages sent from the Kapsel push plugin.  Note, this filter will not show the messages displayed using console.log().
  • On some Android devices there is an error while registering for notification.
    java.lang.UnsupportedOperationException: Device does not have package

    This occurs since Google Services Framework is missing. There is no solution or workaround for this limitation.

  • Push notifications can be disabled on Android and iOS.
    On iOS open Settings > Notifications > PushDemo
    On Android open Settings > Apps > PushDemo > Uncheck Show Notifications
  • On Android, there are separate volume controls for the notifications and alarms.  If you do not here a notification sound check the volume level for Notifications. Settings > Sound > Volumes > Notifications.
  • On Android, the sound played when a notification arrives can be selected.  Settings > Sound > Default notification.

    On an Android emulator, the sound file first needs to be copied onto the device.  Open the DDMS perspective in eclipse, select the File Explorer and copy C:\adt-bundle-windows-x86_64-20130917\sdk\platforms\android-19\data\res\raw\fallbackring.ogg to storage\sdcard\Notifications.  Restart the emulator.  Fallbackring should now be accessible in the settings.

Note, there is an open source push plugin that is described at Cordova Push Notifications Plugin.

The following post describes some items to keep in mind once your push enable app is ready for release.  Keeping Google Cloud Messaging For Android Working Reliably.

Back to Getting Started With Kapsel

You must be Logged on to comment or reply to a post.
  • Hi  Daniel, great blog! I ran into a little problem at the end though. Registering for Push works nicely and i can actually see the GCMIntentservice onMessage function being called on my device in my Logcat when i sent a push notification to SMP Cloud Trial server . However, when the SMP_PUSH_PLUGIN is supposed to be called, i get an additional call from SMP_PUSH_INTENT with the error Notification format error: c2dm section is missing. So i don't get to see the alert while in foreground, nor when i press the Check for notification error. Any idea what might be the problem? I am using cordova 3.4.0 in combination with SMP SDK 3.0 SP2 and Android 4.4. Thanks in advance!


    • The Getting Started with Kapsel Guide was written using the SMP 3.0 on premise rather than the Cloud Trial server.  I have been hoping to look into some of the issues encountered when using the Cloud Trial server but have not been able to yet. 


      The Kapsel Push plugin was looking for a very specifically formatted message in the SP02 release.  I believe it is much more accommodating in the upcoming SP03 release.


      One workaround would be to try the Cordova Push plugin.  An example of how to use it is available in Getting Started with Kapsel - Appendix H -- Non Kapsel Plugins


      Hope that helps,


      Dan van Leeuwen

  • Hi All,


    I have a question on SMP3 and  Kapsel PUSH Notification,




    I'm new to SMP3.0 (No prior Exp on 2.3 and other SAP tools), but i have experience on Mobile App development respective to cordova, and made a cordova push notification sample which worked well, but ddn't successed on SMP.


    I made all the necessary stuff required to configure PUSH Notification int SMP3.0 COCKPIT for Android Hybrid App development.



    Sender ID : 9888XXXXXX


    Authentication : set to "default"


    Mobile App:


    App successfully registered with SMP, and i could see the APP registred ID in cockpit :ed0f5105-2bc4-4xxxc5-axxx-bxxxxxxxxxxx, 

    and GCM device regID :


    AndroidGcmRegistrationId : APA91bGrAJfHmICRKwpCUuB9nOlfduzBVr6CLAhW7JgITKnhbyGLjPhsfToGOzkfDm-WxMKkvKjXhoroENMi1bon9jkt-OPB22ky51j3HznJiY2oAaFhdKxxxxxxxxx-xxxxxxxxxxxxxxxxxwwwwwfffx-xxxxxxxx,


    My only concern is when i start sending a data from Restful Clinet with below data, it asks for username, password (defaults: smpPushUser/SmpPushPwd) but didnt worked, tried with all the other options for Username & passwords nothing  worked,


    Finally in cockpit - > settings -> Notification (Cannotdelte) - >created a New SystemLogin authernation with username & password,


    Which worked as username/password while requesting from rest client.



    X-SMP-GCM-DATA : {"dispmsg":"Hello GCM Message!","appid":"","appname":"","reasonurl":"","reasoncode":12345}


    I always getting , 404 or 403 error, "Application didn't registered"  & forbidden access errors




    1) Could some one tell me did i missed any mandatory steps ?

    2) Why the username, password not worked ?


    3) DO we need to send GCM registerID to SMP back ?


    4) HOW SMP will get to know if some update is available to specific mobile user ? , i mean if SAP HR system has an update to one specific user which has to PUSH to user's mobile device, how do SMP will get to know abut this update and push to specific Mobile device of user?


    I followed Below docs :



    Getting Started with Kapsel - Part 4 -- Push



    Thanks in Advance, Help me in understanding the PUSH mechnaism in-respect to SMP 3.0


    Please point to Right resource & Sample .




    • When you added a System Login authentication provider with a user name and password of smpPushUser and smpPushPwd, did you specify the role to be Notification User?





      <<DO we need to send GCM registerID to SMP back?




      After the call to sap.Push.registerForNotificationTypes() succeeds, the push plugin will send the regid to the SMP 3.0 server using the settings plugin.





      <<if SAP HR system has an update to one specific user which has to PUSH to user's mobile device, how do SMP will get to know abut this update and push to specific Mobile device of user?




      The HR system will need to make the appropriate REST call.







      <<Could some one tell me did i missed any mandatory steps


      Verify that you are using SP03 server and SP03 SDK.  In the top right of the management cockpit, it should indicate the SMP 3.0 server version.  The SDK version can be determined by examining the plugin.xml file for any of the Kapsel plugins.




      I would suggest uninstalling the app, redeploy it, click on the button register for push, monitor the logcat to see if there are any errors that might indicate a problem, then try the REST call with the notification info and again monitor the response from the REST call and and look at the Android logcat.




      Hope that helps,



      Dan van Leeuwen

      • Thanks Daniel for your time.


        Please find my comments below.


        System Login authentication provider with a user name and password of smpPushUser and smpPushPwd, did you specify the role to be Notification User?



        Vishnu : YES, I have given the same credentials & Notification USER Role.


        After the call to sap.Push.registerForNotificationTypes() succeeds, the push plugin will send the regid to the SMP 3.0 server using the settings plugin.

        Vishnu :  COOL,  then developer doesn't need to write code for this right ?

        <<if SAP HR system has an update to one specific user which has to PUSH to user's mobile device, how do SMP will get to know abut this update and push to specific Mobile device of user?




        The HR system will need to make the appropriate REST call.



        Vishnu : Bit Confusion, does SMP has mechaniscm to listen for Netwear gate way PUSH subscribes ? or SMP has any service URL to provide to backend  team to PUSH new Updates so SMP can listen ?


        EX: like in sample




        We were pushing data to APP this way, to test.


        But in real-scenario

        How SMP listens for HR REST call & Differentiates it & push to respective Mobile USERS ?



        I wasn't clear on this,  Sorry Again for asking in Depth. Please clarify



        Verify that you are using SP03 server and SP03 SDK.  In the top right of the management cockpit, it should indicate the SMP 3.0 server version.  The SDK version can be determined by examining the plugin.xml file for any of the Kapsel plugins.


        VISHNU :  SMP Server version :3.0.3,  SDK Version : 3.0.3


        VISHNU : Trying to Fresh APP. Will update the logs.



        Thanks Again


        Have a Great Day.

        • Hi Daniel,


          Rest Client shows the Notification submitted for processing, but still i couldn't see any notification in device or in emulator, Check for Notification button click show up nothing.



          6-11-2014 7-34-18 PM.png

          6-11-2014 7-34-18 PM.png
          • The 201 response from the REST client looks good. 


            The Check for Notification button calls a method that will process notifications that have been sent to the device when it was not in the foreground. 


            As no information appears in the logcat log after the REST client sends the notification, have you looked at the log information produced by the SMP 3.0 server?  I believe there is also Push section under the Logs heading in the mangement cockpit.


            Is it possible that the ports used by GCM are blocked on your network?



            <<How SMP listens for HR REST call & Differentiates it & push to respective Mobile USERS ?

            I believe the backend system will need to keep track of the registration ID's so that it can send the notification to the correct user.

          • Hi Daniel,

            Appreciate your Support & Time, Thanks a lot ....:)


            Yes, I was observing those logs,

            This was the error in SMP server PUSH logs, didnt find any error in Mobile App Andorid Logs




            Jun 11 2014 08:09:27


            No data to be pushed to device


            2014-06-11 08:09:27.528#ERROR#GCMNotificationDelegate#smpPushUser#No data to be pushed to device

            2014-06-11 08:09:27.536#ERROR#PushNotificationDelegator#smpPushUser#Exception Caught while Push Notification : java.lang.IllegalArgumentException: No data to be pushed to device :: [,, sun.reflect.GeneratedMethodAccessor637.invoke(Unknown Source), sun.reflect.DelegatingMethodAccessorImpl.invoke(, java.lang.reflect.Method.invoke(,,

          • Thanks for links Daniel, Cordova plugin worked indeed, but now in SMP server -> LOGS->PUSH Logs - > I can see all green colored (Success)icon, but no Push notification received at client app. both forground, background.


            Client App has- > AVD - >4.4 (19) -> Google API

            lib -> has GCM.jar, Gooogle play services.

          • Just to be clear, the notifications are successfully received on the device when you use

            node notify.js


            The notifications are not received on the device when you send them via a REST client to the SMP 3.0 server.


            Is the SMP 3.0 server running on your laptop or on another machine?

            It may make sense to see if you can increase the log level of the SMP 3.0 server to capture some additional log entries on the error and post them and the problem you are seeing on the newsgroup SMP Developer Center


          • Yes Daniel, with plain cordova push plugin, everything works well,


            But Android App developed using kapsel push plugins, and integrated with SMP3.0, doesn't work,



            Yes, true, the notifications are not received on the android emulator device when i send from  REST Client to SMP 3.0 Server.


            SMP 3.0 server Running on Different machine, and client on different machine.



            Please find the attachement, SMP3.0 PUSH logs. If observed in the last, i have marked red in color, there is and ERROR saying " End time for  processing PUSH Notification.


            I have no clue what to do next,


            I have cross checked multiple times with network admins in my organisation, they have confirmed all relevant PORTS are available & are open.


            6-17-2014 2-53-31 PM.png

            6-17-2014 2-53-31 PM.png
  • In push.js line 235, can't find variable:errorCallback. function argument has registerFailure, registerFailure should be used to replace errorCallback or sap.Push.RegisterFailed replace it.

  • Hi Daniel,


    I am getting invalid notification target id in the response.


    I am trying this on my home network (wi-fi), i have opened PORT 5228 through router and so getting below response after hitting netstat command from my laptop.push-3.PNG


    I have added sender id, API key details, added "System Login (Admin only)" authentication provider in "Notification sec provider" as per your document. Restarted system.


    In the "Authorization" header i am giving "smpPushUser" & "smpPushPwd"






    did i miss anything?




    • I would double check your X-SMP-DATA message in your screen shot.


      If the status is 404, this may indicate that the app did not successfully register for notifications.  Try pressing the Register for Push button again and verify that the Successfully registered alert displays.


      You can also check the SMP Push logs.

  • I am not trying with given code sample. what i have done is:

    1. I just created a simple application id in admin cockpit, added sender Id, API key details in "PUSH" tab
    2. Added a new authentication provider in "Notifications" security provider
    3. restarted machine
    4. registered an android device using Advanced rest client
    5. run a POST method as i mentioned in above comment


    Is it not a correct way for registering a device for notifications?

    About the "X-SMP-DATA" message, if i have to send a test notification (just to make sure notification is working properly) then what should i mention?


    I also tried with above steps but i couldnt find gcm folder under google.

    • Copy the below jar into the libs folder of the PushDemo project.C:\Android\adt-bundle-windows-x86_64-20130522\sdk\extras\google\gcm\gcm-client\dist\gcm.jar



    • The X-SMP-DATA message appears to have mismatched { }.  I would likely include the two field shown in the sample above, alert and dispmsg.


      The app on the device or emulator needs to register with the GCM server before you will be able to send a notification to it.  In order for it to register, it needs the gcm.jar file to be added to the project and your app needs to call sap.Push.registerForNotificationTypes. 


      Here is a screenshot of library needed in the SDK Manager.  Perhaps you need to download it.



      • Is it possible to register an android device with GCM server directly from REST client?


        btw I dont see this "Deprecated GCM for Android Library option" as above mentioned in "Extras".

        After googling i found this link android - Add gcm.jar in Eclipse IDE (Google Cloud Messaging) - Stack Overflow says The information in this document has been superseded by GCM Server and GCM Client. Please use the GoogleCloudMessaging API instead of the GCM client helper library. The GCM server helper library is still valid.


        What do you suggest?

        • /
          • Daniel Van Leeuwen


            I have found gcm.jar file in extras and copied into project. As soon as i launch android simulator, i can see Registration screen. If i click on "Register" i can see a new app id created in admin cockpit.



            I have tried by pressing "Register for Push" button i dont see any kind of alert. What do you say?

            I have checked port 5223-5330 are open.



          • What messages are you seeing in your Android logcat log file after pressing the Register for Push button? 


            I get messages like


            08-12 09:46:14.855: V/GCMRegistrar(6169): Registering app com.mycompany.push of senders 79146572xxxx


            08-12 09:46:15.105: V/GCMBroadcastReceiver(6169): onReceive:


            08-12 09:46:15.115: D/GCMBaseIntentService(6169): handleRegistration: registrationId = APA91bGRmlSB...


            08-12 09:46:15.115: I/GetAClue::GCMIntentService(6169): GCMIntentService onRegistered called


            08-12 09:46:15.125: I/GetAClue::GCMIntentService(6169): Registration id is: APA91...


            Then the alert dialog shows indicating success.

          • /
  • Hi All,


    I’m trying to run Push Notification Rest API (POST) SMP3 SP5 :

    When I start sending a data from Restful Client (see below), I got a status code: 201





    Body: X-SMP-DATA:
    {"alert":"Title", "dispmsg":"msg"}






    In the SMP log  we got an error:



    data to be pushed to device# Not a json object...  

    Any help would be greatly appreciated



    • In the screenshot above seems to be using a different format.  There appears to be two { and only one }.


      In the SMP server, you can increase the log level of certain components such as push to perhaps get additional details shown in the log.


      Settings > Logs > Settings > Push > Log Level -> debug, Trace -> enabled.




      Dan van Leeuwen

      • Hi Daniel


        thanks for your great document. We are delivering a PoC in a customer, and they want to see some push demo on windows phone. In SMP SDK SP05, we have windows phone sdk for Kapsel. but the document is not very detail. Do you know if we have any existing windows phone push demo code for our reference?


        Many thanks!

      • HI Daniel,


        I am able to Observe the notification as Banner in my device. But not as a popup.

        So i tried Push from Request Body of Rest Client.But didnt workout.

        Is there anyway that or any format im missing from rest client while pushing notification so that i can see the below data in popup.





          • Yes it works in the if i pass that X-SMP-DATA in headers , i can see Notification as banner. But i cant see the Notificaiton details when i launch the application.

            Im just trying to see the Notification once i launch the Application.

          • In your screenshot above, note that you have included X-SMP-DATA in the payload section of the Advanced REST Client. 


            The X-SMP-DATA should be placed in the Headers section.


            The banner should contain the both passed in parameters as well.  "Title" and "msg"

          • Hi Daniel,


            yes you said right, i get title and msg in Banner. But when the app is active instead of banner.,i wanted to see the popup which is mentioned in your document.So im not getting that popup with title and message. Its only coming in Banner



          • Is the app open when you send the message?  Note, you also must call registerForPush each time your app starts.  Are you seeing the issue with the provided index.html or with your own app?


            Note that when reopening the app, the Register For Push button must be pressed again or in a non-sample app, it should be called in the logonSuccessCallback method which would be called each time the application starts.

  • Hi Daniel,


    I got below Error when im importing Push Plugin.It seems there is dependency on Settings Plugin./wp-content/uploads/2014/10/console_573996.png

    So i have installed settings Plugin



    Still i am getting same issue.Do you have any idea on this Error?

    please help in this regard, and let me know what are required plugins in terms of GCM specifically?




    • Have you tried creating your project with plugin_search_path parameter?


      cordova -d create C:\Kapsel_Projects\PushDemo com.mycompany.push PushDemo "{\"plugin_search_path\":\"C:/SAP/MobileSDK3/KapselSDK/plugins/\"}"


      The dependencies for a plugin are listed in its plugin.xml file.


      C:\SAP\MobileSDK3\KapselSDK\plugins\push\plugin.xml contains

      <dependency id="" />
      <dependency id="org.apache.cordova.inappbrowser" />     
      <dependency id="" />     
      <dependency id="" />
      <dependency id="" />
      <dependency id="org.apache.cordova.device" />




      Dan van Leeuwen

      • Yes Daniel, I did using plugin_search_path only


        cordova -d create C:\KapselFramework\Demo8 Demo8 "{\"plugin_search_path\":\"C:\\KapselFramework\\smpplugins\\plugins\"}"


        Where i have copied the plugins in smpplugins/plugins folder.




        • What version of Cordova and of the Kapsel SDK are you using?



          C:\Kapsel_Projects\PushDemo>cordova -v

          should return 3.5


          C:\Kapsel_Projects\PushDemo>cordova plugins

 3.5.0 "AuthProxy"


  • Hello,


    I am trying to push notification from SAP Netweaver Gateway using the HTTP header option, as mentioned in URL:- SAP Gateway Notification Support - REST API Application Development - SAP Library.


    So in my Gateway system I need to create RFC destination to SMP for the URL -  http[s]://<host:port>/<Notification>/<registration ID>.


    If i have 100 mobile users then there would be 100 different registration IDs. So in this case how can I create RFC destinations from Gateway system to SMP server? Should i create separate RFC destination for each registration?




  • Hi,

       I am trying to implement push notification using KAPSEL for both android and iphone devices. The SMP server is behind the proxy. I have done the proxy settings in props.ini folder. Android push notification is working fine. I am creating notification using firefox rest client and the android device is receiving it.

      However when i am using iphone, the iphone device is not receiving the notification. I have configured the certificate and password for the APNS setting in SMP. When I am creating the notification in rest client i am getting 201 created message also. But the device is not receiving the notification.


    When I went through ADMIN guide I found that we have to configure SOCKS proxy host and port in props.ini for APNS. Is this mandatory???.


    Also I found a note in Admin guide "

    Note: The default URL is for a production environment; for a development and testing environment, change the URL to"


    What do we need to do??



    Can u please guide how to debug this issue.


    thanks and regards,


  • Thanks Dan, I was able to get push notification working with an Android device. I'm now trying to enable it on iOS. I have created the apns certificate and installed it on the push tab of the management cockpit.


    I created an iOS version of the push demo app from above and deployed it to my iPhone (apparently the simulator does not support remote push notifications). When I run the app and tap on Register for Push I get the following error:




    An error occurred in index.html (at line #1): SyntaxError: Unexpected identifier 'aps'. Expected ')' to end an argument list.


    This seems to be coming from the onError function:


    function onError(msg, url, line) {

                var idx = url.lastIndexOf("/");

                var file = "unknown";

                if (idx > -1) {

                    file = url.substring(idx + 1);


                alert("An error occurred in " + file + " (at line # " + line + "): " + msg);

                return false; //suppressErrorAlert;



    but I'm not sure what is causing it. Any help or resources you can point me to for getting it to work with iOS would be great.


    Also, any tips on incorporating this functionality into the Fiori Client Kapsel app? I need to have that automatically register for push notifications (both iOS an Android).


    Edit: Here is the registerForPush function syntax:


    function registerForPush() {

                var nTypes = sap.Push.notificationType.SOUNDS | sap.Push.notificationType.ALERT;

                sap.Push.registerForNotificationTypes(nTypes, regSuccess, regFailure, processNotification,null);  //GCM Sender ID, null for APNS




    • I've made some progress but I still don't have push notification working for an iOS device yet. I resolved the error with the push notification plugin (mentioned above) by creating and installing a provisioning profile on my iPhone.



      I also generated the necessary certificate on the Apple web site, exported it as .p12 certificate and imported it on the Push tab for the application in the management cockpit. When I send a push notification to the SMP server now I am getting back a 201 status, so that part is working fine.


      But if I check the log file for the SMP server I see the following:



      2015 02 28 CSI context found in the authentication session. Performing the role check using HttpRequest#null#727#null#1425151012141000#null |

      2015 02 28 Not a json object...#null#728#Notification#1425151012161000#null |

      2015 02 28 closed: 8#null#730#null#1425151013065000#null |



      Here is the URL that I am using to send the push notification:



      And here is the payload:

      {"alert":"New Vacation Approval Request", "data":"For (i826565) request (7)" }


      I'm not sure if the documentation is out of date but in one section it says the following:




      From the cockpit, select >Applications > Push

      Under Apple, select APNS endpoint. "None" is the default endpoint value for all the applications.




      The default URL is for a production environment; for a development and testing environment, change the URL to

      (DF: There is no place to set the URL to the gateway in the management cockpit)



      Select Sandbox to configure APNS in a development and testing environment, or Production to configure APNS in a production environment.

      Click Browse to navigate to the certificate file.

      Select the file, and click Open.

      Enter a valid password.




      So I don't know if the problem is that the request is attempting to go to the production APNS URL instead of the sandbox URL (I generated a sandbox certificate), or if the problem is caused by the server thinking that the payload is not a json object.




      • I turned on the debugging and tracing features for the server log and it is providing me with more information.


        The request is definitely getting sent to the right APNS server (


        The main issue I see in the log that could be causing the problem is that I'm getting the message Not a JSON object


        I'm using the following in the payload section of the Advanced Rest Client:

        {"alert":"New Vacation Approval Request", "data":"For (dfish) request (7)" }


        I think Apple may require additional information in the JSON that is passed but if I use a JSON example from the Apple Developer Network site I get a 400 Bad Request error:



            "aps" : {

                "alert" : "You got your emails.",

                "badge" : 9,

                "sound" : "bingbong.aiff"


            "acme1" : "bar",

            "acme2" : 42



        So I'm not sure what to do next. Does anyone have an example of JSON payload that works with APNS and SMP?



          • Thanks Dan, that helps. I modified the payload to look like this:


            X-SMP-APNS-DATA: {"dispmsg":"APNS alert!!","appid":"com.mycompany.push","appname":"Push Example","reasonurl":"http://reason","reasoncode":"1234"}



            X-SMP-APNS-ALERT: My name is Dave



            X-SMP-APNS-BADGE: 1



            X-SMP-APNS-SOUND: default


            I now get a 201 return code but in the log file I'm seeing this:


            2015 03 02 CSI context found in the authentication session. Performing the role check using HttpRequest#null#729#null#1425322604994000#null |

            2015 03 02 data to be pushed to device#null#757#Notification#1425322605025000#null


            So I'm getting closer, I just need to figure out why it thinks there is no data to push to the device.



  • Hi ,


    I am new to HCPms and I am trying to develop the push notification with kapsel using WebIDE, I am not getting any response back from the following method.


                   var nTypes = sap.Push.notificationType.SOUNDS |                     sap.Push.notificationType.ALERT;



                function(result) {


                    alert("Successfully registered: " + JSON.stringify(result));


                function(errorInfo) {


                    alert("Error while registering.  " + JSON.stringify(errorInfo));


                function(notification) {

                    alert("in processNotification: " + JSON.stringify(notification));


                "sender id");


    No alert is been thrown, not sure whether the application is registered for push and when i try to check from rest client by post request to push url, I am getting 403 forbitten error, Kindly help.


    Thank you


    • It might help to add the Kapsel logger plugin to the project, increase the log level of the Kapsel Logger plugin and then to retry your test.


      Getting Started with Kapsel - Part 6 -- Logger


      Another option would be to step through the code with the debugger

      Getting Started with Kapsel - Appendix B -- Debugging


      Some corporate networks might be blocking the ports used for PUSH notifications.


      Finally, I would also monitor the SMP server's log. 


      Hope that helps,


      Dan van Leeuwen

      • Hi Dani,


        I got the success response finally, the issue was baecoz of gcm library not configured properly and now when I am sending the notification from rest client, I am getting the response 201 created but in log i can see the authentication issue, and the notifications are not reaching the mobile. Here is the log


        #2.0#2015-04-27 Notification sending failed, because the GCM server can not authentificate the sender account : 401#

        I tried changing both server and android api key from google console, but no help. Any suggestion ?

        Thank you

        Kishore Kumar

  • Hi Dan,


    I'm just curious with regards to this statement:

    "when reopening the app, the Register For Push button must be pressed again or in a non-sample app, it should be called in the logonSuccessCallback method which would be called each time the application starts"


    Can you explain why?




    • The method registerForNotificationTypes currently has to be called each time the app starts as it registers the JavaScript callback method.  I believe changes to this are being considered for a future release (post SP09).



      Dan van Leeuwen

    • Hello Daniel,

      I have encountered an error with register for push, it is said that

      "2015-07-23 11:02:11.183 PushDemo[2579:195015] PushNotificationPlugin: Register for Notification

      2015-07-23 11:02:11.184 PushDemo[2579:195015] IN:PushNotificationPlugin: Register for Notification

      2015-07-23 11:02:11.185 PushDemo[2579:195015] registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.

      2015-07-23 11:02:11.186 PushDemo[2579:195015] DE:Registration request send Succesfully (lldb) ".

      And I your demo, which ios version did you use?

      And I have studied on website and have found that for ios8 apns push had changed the API. So how to solve this problem?

      Thanks for your help.

      • What version of the SMP 3.0 SDK are you using?

        One way to check this is to examine the following file in your project and search for version.





        I would recommend checking the version of the SMP 3.0 SDK that you are using and upgrade to the latest SP08 or SP09 version if you are using an older one.


        Hope that helps,


        Dan van Leeuwen

  • Hi Daniel Van Leeuwen,


    I am trying to push notification from SMP using rest client as shown in the above guide but i do not get to see any notification on the Device. When i inspect the logs i see below entries which says notification was submitted to Google but it never comes on device









    Can you please suggest.



    Rakshit Doshi

    • On the device have you successfully registered for push on the device?  You may wish to unregister and re-register both from the SMP server and for push.




      Dan van Leeuwen

  • Hi Daniel,


    I followed the document and completed the push notification in Android Device. But I come across one problem that if we send multiple notification for same application it won't group into single notification instead it show it as third different notification for same application.


    Can you please suggest what can be done over here.


    Thanks and Regards,


  • Hi Daniel,

    Do we've a way to get registration ID per user ID except from get in to Admin console manually since i need to send notification for specific user  .

    Or i need to do query from SMP DB?



  • Hi Daniel,

    Do you know if i can do the AuthProxy registration using client cert with Push Notification since in your sample you mention only the Logon.Init() for registration .



  • Hi Daniel,


    Thank you for this excellent post. I have a doubt that I would like to clarify:

    The device registration is working fine.

    The Push Notification registration is working fine also. I am able to send notifications and see them from the mobile device.

    The only problem I have is with the "unregisterForPush" function that is not working.

    Do you know why this may be happening?


    function unregisterForPush() {

                 var nTypes = sap.Push.notificationType.SOUNDS | sap.Push.notificationType.ALERT;





    Best Regards,


    • Can you provide a few more details regarding how it is not working? 

      What version of the SDK are you using?

      What version of Android?

      Are there any error messages in the logcat or JavaScript console?


      How long have you waited after unregistering? 


      I think I read somewhere that it may take some time for the unregistration process to complete.  (5 minutes?).



      Dan van Leeuwen

    • Which platforms are you interested in? 


      A new feature in SP10 of the SDK was to support background notifications on iOS. 


      I don't believe there is currently any comparable functionality in the Kapsel Offline OData plugin on Android.


      You could of course use the open source push plugin and modify it yourself as needed.



      Dan van Leeuwen

      • Hi Daniel,


        We are targeting Android, iOS and Windows Phone, the idea is for example to send a URL as extra data and tell the notification received event to open that URL.


        thanks !!


  • Hi,


    I am developing a hybrid mobile application having logon, offline and push functionalities. I have been able to successfully register my device by using logon. For push, I followed the steps as mentioned above. When I am testing the application on my device, the device gets successfully registered on SMP server and I also get a success message, when I press register for push button. But when I am trying to get the notification by hitting the request on rest client, it shows "notification submitted for processing" and I get a 201 created status, but in the mobile device I am unable to receive any notification. I am using Android 4.4.2 version device for testing. My server is SP06 and Kapsel SDK is SP07. One more thing, my SMP server is hosted in client network for which I am using net-scalar reverse proxy for registering the device from open net. I have even tried the same by clearing all the pre existing registrations in the SMP server, but the problem still exists.


    It would be great help if you provide me solution for the above mentioned issue as this is becoming a hard stop for our project.


    One Issue might be port blocked, can you please tell where to enter the GCM ports ie 5228, 5229 and 5230. Am i suppose to enter these ports separated by comma after 8080?

    http proxy settings.JPG


    Thanks and Regards

    Raunak Sinha

    http proxy settings.JPG
  • Hi Daniel Van Leeuwen,

    We are developing a capsule hybrid application and testing it on the Android platform. We have push notification also part of it.

    Currently push notification is working on the case where the user has closed the application.

    But if the user has removed the running instance of the application or has some other application currently running then we are not getting a push notification.

    When I tried to debug this I see that, in the use case where it works I get a callback registered for the Push Notification Processing. But in the other cases I get the payload along with X-SMP-DATA passed as a JSON payload. Can you please help me with what I am missing for the callback in other cases.



      • Hi Danial,


        I also tried with the index.html from the sample in the guide too. Here also I am facing similar issues. From my debugging, what I see is, in the below code from the standard Push.js, I see that all push notification call come to here but from here It moves to if part of below code when app is in background and some other app is active. Also, observed similar behavior (2nd and subsequent calls) when app is in foreground. But only once it went to else condition and was able to see the alert from call back.


        ProcessNotification: function(message) {

        if (sap.Push.ProcessNotificationForUser == null )


          console.log("No Processing function provided");

          sap.Logger.debug("Notification listener function is not registered. Register it by calling registerForNotificationTypes","PUSHJS",function(m){},function(m){});

        } else {






        • What are the steps that you do to reproduce the problem? 


          Note that your application must call registerForNotificationTypes each time it is started.  A good place to add this logic would be in either the logonSuccess callback or the onSapLogonSuccess event.


          I would add some console.log statements to your app to make sure that registerForNotificationsTypes is being called and the successCallback for that method is being called each time your app opens after it has been exited.


          I don't believe registerForNotificatinTypes needs to be called after the app is resumed.


          Here is some code that adds console.log message for a few of these events.


                      document.addEventListener("onSapLogonSuccess", function () {console.log("sapLogonSuccess YYZ")}, false);


                      document.addEventListener("resume", function () {console.log("resumed YYZ")}, false);


                      document.addEventListener("pause", function () {console.log("paused YYZ")}, false);

          • Hi Dan,


            Currently we are not calling registerForNotificationTypes() on every logon. But instead called once during installation of application.


            Is it required to call registerForNotificationTypes() on every logon. If so wouldn't every register on the APNS or GCM require a unregister aswell, as this might end up creating too many connection instances on the GCM or APNS server.


            Can please brief me about if every registry needs a unregister. If not, is the duplication on connection registration avoided internally by plugin.




          • Hi Sachin,


            Calling registerForNotificationTypes() is necessary on every start of the application. If this method is not called the callback for notification received is not registered again.

            Calling this method does not generate a new GCM/APNS token, once you made the first registration it does not regenerate it. Subsequent calls register the javascript callback only.

            This means unregister doesn't have to be called every time.


            Best Regards,


  • Could I set JSON data into PUSH message, so I could later easily consume this data. 

    Currently I am using only IOS. I figured that

    "data": "{\"NotificationId\":\"666666\"}" is working ( with this message I got it on device ). But how could I parse it ? I mean how could I get NotificationId ?