Enable Push Notifications in the MDK Public Store Client
- How to use MDK push register action
- How to use predefined push configuration for the public store version of SAP Mobile Services client (MDK client)
- How to send push notification to an MDK app
Prerequisites
- Tutorial group: Set Up for the Mobile Development Kit (MDK)
- Install SAP Mobile Services Client on your Android device or iOS

Android
iOS
(If you are connecting toAliCloudaccounts, you will need to brand your custom MDK client by allowing custom domains.)
You may clone an existing metadata project from GitHub repository and start directly with step 5 in this tutorial.

- Step 1
-
Open the SAP Mobile Services admin UI, click Push Notification feature.

You can add Push Notification feature by clicking on + icon in case feature is not already assigned to the application.
-
Select SAP Mobile Services Client under Predefined for option, click Save.

Predefined push is supported only for the MDK (SAP Mobile Services client) public store client.
If you want to enable push notification in your custom MDK client then follow Enable Push Notifications in Your Branded MDK Client tutorial.
Which option is not available under Predefined for dropdown?
-
- Step 2
This step includes creating a mobile project in SAP Build Lobby.
-
In the SAP Build Lobby, click Create > Create to start the creation process.

-
Click the Application tile and choose Next.

-
Select the Mobile category and choose Next.

-
Select the Mobile Application to develop your mobile project in SAP Business Application Studio and choose Next.

-
Enter the project name
mdk_push(used for this tutorial) , add a description (optional), and click Review.
SAP Build recommends the dev space it deems most suitable, and it will automatically create a new one for you if you don’t already have one. If you have other dev spaces of the Mobile Application type, you can select between them. If you want to create a different dev space, go to the Dev Space Manager. See Working in the Dev Space Manager.
-
Review the inputs under the Summary tab. If everything looks correct, click Create to proceed with creating your project.

-
Your project is being created in the Project table of the lobby. The creation of the project may take a few moments. After the project has been created successfully, click the project to open it.

-
The project opens in SAP Business Application Studio.

When you open the SAP Business Application Studio for the first time, a consent window may appear asking for permission to track your usage. Please review and provide your consent accordingly before proceeding.

-
- Step 3
The Storyboard provides a graphical view of the application’s runtime resources, external resources, UI of the application, and the connections between them. This allows for a quick understanding of the application’s structure and components.
- Runtime Resources: In the Runtime Resources section, you can see the mobile services application and mobile destination used in the project, with a dotted-line connected to the External Resources.
- External Resources: In the External Resources section, you can see the external services used in the project, with a dotted-line connection to the Runtime Resource or the UI app.
- UI Application: In the UI Applications section, you can see the mobile applications.
-
Click on + button in the Runtime Resources column to add a mobile services app to your project.

This screen will only show up when your CF login session has expired. Use either
CredentialsORSSO Passcodeoption for authentication. After successful signed in to Cloud Foundry, select your Cloud Foundry Organization and Space where you have set up the initial configuration for your MDK app and click Apply.
-
Choose
myapp.mdk.demofrom the applications list in the Mobile Application Services editor and click Add App to Project. You do not require to add a destination for this tutorial.
You can access the mobile services admin UI by clicking on the Mobile Services option on the right hand side.
In the storyboard window, the app will be added under the Runtime Resources column.

-
Click the + button in the UI application column header to add mobile UI for your project.

-
In the Basic Information step, select No for the Enable Auto-Deployment to Mobile Services After Project Creation property, and click Finish. You will modify the generated project in next step and will deploy it later.

-
After clicking Finish, the storyboard is updated displaying the UI component. The MDK project is generated in the project explorer based on your selections.

- Step 4
In this step, you will create the following actions:
-
Push Notification Register action: this will register the device with SAP Mobile Services for push notification.
-
Message actions: these will display a message if Push Notification Register action has succeeded or failed.
-
Create a Push Notification Register action.
Right-click the Actions folder | MDK: New Action | choose Other in Category | click Push Notification Register | Next.

In the Base Information step, provide the below information and click Finish to complete the action creation process.
Property Value NamePushRegister
More details on Push Notification Action is available in help documentation.
-
Define a success message if the Push Register Notification action is succeeded.
Right-click the Actions folder | MDK: New Action | choose Message in Category | click Message | Next.

In the Base Information step, provide the below information and Click Finish.
Property Value NamePushRegisterSuccessMessageTypeSelect Messagefrom the dropdownMessagePush Notification registeredTitleSuccessOKCaptionOKOnOK--None--CancelCaptionleave it blank OnCancel--None--
-
Define a failure message if the Push Register Notification action is failed.
Right-click the Actions folder | MDK: New Action | choose Message in Category | click Message | Next.

In the Base Information step, provide the below information and Click Finish.
Property Value NamePushRegisterFailureMessageTypeSelect Messagefrom the dropdownMessagePush Notification didn't registerTitleFailureOKCaptionOKOnOK--None--CancelCaptionleave it blank OnCancel--None--
-
Define Success and Failure actions for
PushRegister.action.In the action editor for the new action, expand the Common Action Properties and provide the below information:
Property Value Success ActionClick the link icon to bind it to PushRegisterSuccessMessage.actionFailure ActionClick the link icon to bind it to PushRegisterFailureMessage.actionWhen
PushRegister.actiongets executed successfully thenPushRegisterSuccessMessage.actionwill be triggered or ifPushRegister.actionfails thenPushRegisterFailureMessage.actionwill be triggered.
-
- Step 5
In the step, you will set and call the Push Register Notification action when app is updated with the new metadata.
It is up to developers how they want to call a Push Register Notification action.
In
Application.appfile, bind theOnDidUpdateevent toPushRegister.action.
- Step 6
So far, you have learned how to build an MDK application in the SAP Business Application Studio editor. Now, you will Deploy the Project definitions to Mobile Services to use in the Mobile client.
-
Click the Deploy option in the
Application.appheader area, and then choose the deployment target as Mobile Services .
-
Select deploy target as Mobile Services.

-
Select Mobile Services Landscape.

-
If you want to enable source for debugging the deployed bundle, then choose Yes.

You should see Deploy to Mobile Services successfully! message.

-
- Step 7
SAP Business Application Studio has a feature to display the QR code for onboarding in the Mobile client. To view the onboarding QR code, click the Application QR Code icon in the editor’s header area.

The On-boarding QR code is now displayed.

Leave the Onboarding dialog box open for the next step.
What Message would be displayed in case Push register action fails?
- Step 8
Make sure you are choosing the right device platform tab above. Once you have scanned and on-boarded using the onboarding URL, it will be remembered. When you Log out and on-board again, you will be asked either to continue to use current application or to scan new QR code.
- Step 9
Make sure you are choosing the right device platform tab above.
Once you have scanned and on-boarded using the onboarding URL, it will be remembered. When you Log out and on-board again, you will be asked either to continue to use current application or to scan new QR code.
- Define push notification settings in app configuration
- Create a New Project Using SAP Build
- Configure the Project Using Storyboard
- Create MDK actions to register for push notifications
- Call the push register action
- Deploy the Project
- Display the QR code for app onboarding the Mobile app
- Test a Simple Notification in MDK client
- Test an Advanced Notification in your MDK client