Skip to Content
Author's profile photo Steve Lutarewych

How to use SAP HCP, mobile service for SAP Fiori – part 4 cont.

This is a continuation of How to use SAP HCP, mobile service for SAP Fiori – part 4

Now, before we can send a Push Notification we need to assign our user the Push Notification Role and determine the Push URL to post our message.

1. Return to the HCP Cockpit and go to Services, Development and Operations.

Picture1.png

2. Select Configure Development and Operations.

Picture2.png

3. Select Roles, then in the Roles Section select Notification User.  In the bottom section assign your HCP trial ID to this Role (your trial ID can be derived from the breadcrumb trail at the top of the screen – p12345678 (without the trial part).

Picture3.png

4. Return to the Development and Operations Service in the HCP Cockpit and select Go To Service

Picture1.png

5. Select Applications in the Navigator and then on the Product Listing Application, right-click the cog and Select Overview.

Picture2.png

6. To send a Push Notification we need to combine the base URL with the Fiori Mobile Application. Begin by coping the Enhanced Push API URL

Picture3.png

and paste it into your Notepad or Text Editor. Next, add “/application/” then we need to get the Fiori Mobile App ID.

7. Return to the Fiori Mobile Admin Console and go to the Product Listing Fiori Mobile App. Select App Settings, Notifications, copy the Application ID and append it to your URL in Notepad or Text Editor.

Picture6.png

When completed, your URL should look like:

PUSH URL = Enhanced Push API URL for the Product Listing App + “/application/” + The Application ID from the Mobile Mobile App Settings Notification Screen

Example:

https://hcpms-p1942059231trial.hanatrial.ondemand.com/restnotification/application/com.sap.mobilesecure.xd537a04511dd05a0e903ea439f9d4978

8. Install the Advanced REST Client in Chrome or open your preferred REST Client.

Picture4.png

9. Create an HTTP Post with the following attributes:

URL: PUSH URL you created above

Type: Post

Header: Content-Type: application/json

Payload:

{

“alert”: “New Product Added”,

“badge”: 1,

“data”: “A New Product Listing has been added.”,

“sound”: “soundval”

}

Picture7a.png

10. Click Send. When prompted for Authentication enter your HCP trial ID and password.\

Picture7b.png

If successful, your should get a 201 Created response.

Picture7c.png

And a Push Notification on your Android device.

Picture8.png

This concludes Part 4 of this blog series.

Check back for more mobile enhancements, including using the camera and turning this into an offline app!

Assigned Tags

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

      Hi Steve,

      I have followed the above activity of your blog and it successfully got a 201 Created response. But, I have not received a Push Notification on my Android device.


      11.PNG

      12.PNG

      Author's profile photo Steve Lutarewych
      Steve Lutarewych
      Blog Post Author

      Ramesh,

      Was you registration successful on the device when you clicked the register button (you should have received a pop-up message)?

      Steve

      Author's profile photo Ramesh Prasad
      Ramesh Prasad

      Hi Steve,

      Sorry for delay reply. I receive a "Push Registration Failed: Cannot access the server" popup message.

      Regards

      Ramesh

      Author's profile photo Amine Lamh
      Amine Lamh

      Hi,

      How can i turn this into an offline app?

      Author's profile photo Danny Van der Steen
      Danny Van der Steen

      Hi Steve,

       

      you also mentioned using offline in your introduction in part 1 to be described in part 4 but we read nothing on that.  Is it possible to also talk on that one?

       

      greeting from Belgium Danny

       

      ps liked your blogs a lot helps us getting started really quick.