Set up the mobile development kit client to accept deep links through URL schemes and HTTP URLs (iOS Universal Links and Android App Links). With this feature, your MDK app can be launched to perform actions like navigating to a page, filter a list based on a parameter, or approving a request from external sources (web page, email, or another app).
🎓advanced⏱35 min.Mobile Development Kit ClientAdvancedIosAndroidMobileSAP Business Technology PlatformSAP Mobile ServicesSAP Build CodeSAP BuildSAP Business Application Studio
You will learn
✔How to handle deep link into MDK application
✔How to use application OnLinkDataReceived event
✔How to configure application links on SAP Mobile Services
Download the latest version of mobile development kit SDK either from the SAP community trial download or SAP Software Center if you are a SAP Mobile Services customer. This is required you to build a branded client.
You may clone an existing metadata project from the MDK Tutorial GitHub repository and start directly with step 3 in this tutorial.
MDK supports deep linking into MDK applications using MDK client URL scheme and HTTP URLs via iOS Universal Links and Android App Links. iOS universal links and Android App Links are the HTTP URLs that bring the user directly to specific content in your MDK application.
MDK
Step 1Create a New Project Using SAP Build
—
This step includes creating a mobile project in SAP Build Lobby.
In the SAP Build Lobby, click Create > Create to start the creation process.
MDK
Click the Application tile and choose Next.
MDK
Select the Mobile category and choose Next.
MDK
Select the Mobile Application to develop your mobile project in SAP Business Application Studio and choose Next.
MDK
Enter the project name deeplinkintomdkapp (used for this tutorial) , add a description (optional), and click Review.
MDK
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.
MDK
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.
MDK
The project opens in SAP Business Application Studio.
MDK
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.MDK
Step 2Configure the Project Using Storyboard
+
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.
MDK
This screen will only show up when your CF login session has expired. Use either Credentials OR SSO Passcode option 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.
MDK
Choose myapp.mdk.demo from the applications list in the Mobile Application Services editor.
MDK
Select com.sap.edm.sampleservice.v4 from the destinations list and click Add App to Project.
MDK
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 and mobile destination will be added under the Runtime Resources column. The mobile destination will also be added under the External Resources with a dotted-line connection to the Runtime Resource. The External Resource will be used to create the UI application.
MDK
Click the + button in the UI application column header to add mobile UI for your project.
MDK
In the Basic Information step, provide the below information and click Next. You will modify the generated project in next step and will deploy it later.
Field
Value
MDK Template Type
List Detail
Enable Auto-Deployment to Mobile Services After Project Creation
Select No
MDK
The List Detail template generates the offline or online actions, rules, messages and pages to view records. More details on MDK template is available in help documentation.
In the Data Collections step, provide the below information and click Finish. Data Collections step retrieves the entity sets information for the selected destination.
Field
Value
Enter a path to service (e.g. /sap/opu/odata/sap/SERVICE_NAME)
Leave it as it is
Select the Service Type
Leave the default value as OData
Enable Offline
It’s enabled by default
Select all data collections
Leave it as it is
What types of data will your application contain?
Select Customers and Products
MDK
Regardless of whether you are creating an online or offline application, this step is needed for app to connect to an OData service. When building an MDK Mobile application, it assumes the OData service created and the destination that points to this service is set up in Mobile Services. For MDK Web application, destination is set up in SAP BTP admin UI.
Since you have Enable Offline set to Yes, the generated application will be offline enabled in the MDK Mobile client and will run as online in Web environment.
Data Collections step retrieves the entity sets information for the selected destination.
After clicking Finish, the storyboard is updated displaying the UI component. The MDK project is generated in the project explorer based on your selections.
MDK
Step 3Add logic to handle deep linking
+
MDK provides an OnLinkDataReceived event in the Application.app that is called when the MDK app is launched from an external link. The data can be accessed via context.getAppEventData().
Click the Application.app to open it in MDK Application Editor and then and select the Create a rule/action for the OnLinkDataReceived event.
MDK
Select the Object Type as Rule and keep the default Folders path.
MDK
In the Basic Information step, enter the Rule name as LinkDataReceived and click Finish to complete the rule creation process.
MDK
Replace the generated code with below snippet.
JavaScript
/**
* Describe this function...
* @param {IClientAPI} context
*/exportdefaultfunctionLinkDataReceived(context){context.getLogger().log(`Link Data Received Triggered`,'Info');letlinkData=context.getAppEventData();letdata;try{data=JSON.parse(linkData);}catch(error){returnnull;}letsplitURL=data.URL.split('/');letaction=splitURL[3];letentity=splitURL.length>4?splitURL[4]:'';switch(action){case'search':if(entity==='product'){returnopenProductListWithFilter(context,data.Parameters);}break;case'product':if(data.Parameters&&data.Parameters.id){returnopenProductByID(context,data.Parameters.id);}break;default:context.getLogger().log(`Unrecognized Link Path ${data.URL}`,'Error');break;}}functionopenProductByID(context,id){context.getLogger().log(`ID: ${id}`,'Debug');returncontext.read('/deeplinkintomdkapp/Services/com_sap_edm_sampleservice_v4.service',`Products(${id})`,[],null).then(function(result){if(result.length){context.getPageProxy().setActionBinding(result.getItem(0));returncontext.getPageProxy().executeAction('/deeplinkintomdkapp/Actions/com_sap_edm_sampleservice_v4/Products/NavToProducts_Detail.action');}});}functionopenProductListWithFilter(context,parametersObj){letpageData=context.getPageProxy().getPageDefinition('/deeplinkintomdkapp/Pages/com_sap_edm_sampleservice_v4_Products/Products_List.page');varfilterQO='$filter=';for(varkeyinparametersObj){varvalue=parametersObj[key];filterQO+=`${key} eq '${value}' and `;}if(filterQO.slice(-5)===' and '){filterQO=filterQO.slice(0,filterQO.length-5);}context.getLogger().log(`${filterQO}`,'Debug');pageData.Controls[0].Sections[0].Target.QueryOptions=filterQO;returncontext.getPageProxy().executeAction({"Name":'/deeplinkintomdkapp/Actions/com_sap_edm_sampleservice_v4/Products/NavToProducts_List.action',"Properties":{"PageMetadata":pageData}});}
Step 4Deploy the Project
+
Now that the MDK application is configured to act when a request from external source is received, you will Deploy the Project definitions to Mobile Services to use in the Mobile client.
Switch to the Application.app tab, click the Deploy option in the editor’s header area, and then choose the deployment target as Mobile Services.
MDK
Select deploy target as Mobile Services.
MDK
If you want to enable source for debugging the deployed bundle, then choose Yes.
MDK
You should see Deploy to Mobile Services successfully! message.
MDK
Step 5Configure Application Links in SAP Mobile Services
+
Open SAP Mobile Services UI, click Mobile Applications→Native/MDK→ click myapp.mdk.demo app.
MDK
Click the APIs tab. Copy the Server URL and paste it in any text editor on your machine. You will need this information later.
MDK
Switch to Android Studio and create a new project using the Empty Activity template.
Once the project is opened in the Android Studio, select Tools→App Links Assistant in the menu bar.
MDK
If you do not see App Links Assistant steps, you may need to click the Create Applink button.
Click Open Digital Asset Links File Generator in the App Links Assistant window.
MDK
Provide the below information and click Generate Digital Asset Links file.
Property
Value
Site Domain
<Server URL> from the step 4.2
Application ID
Provide a unique name. Make sure to use the same value for BundleID in MDKProject.json when you create your .mdkproject in step 5.1
MDK
For productive apps, you must select the keystore with the certificate that will be used to sign the .apk file.
Copy the text under the Preview section.
MDK
Switch to the SAP Mobile Services UI, navigate to the Settings > Application Links tab.
MDK
Click on the pencil next to the Android Universal Links section.
Provide a unique name. Make sure to use the same value for BundleID in MDKProject.json when you create your .mdkproject in step 5.1
MDK
Step 6Create Your Branded MDK Client
+
Follow steps 1 to 3 from this tutorial and make sure to use the same bundle ID in MDKProject.json as you provided for Apple Universal Links settings in Mobile Services and also for Application ID in Android Studio while generating Digital Asset Links file.
Add highlighted files under DemoSampleApp.mdkproject.
Files specified in the .mdkproject/App_Resources_Merge folder override a part of the files in <generated-project>/app/App_Resources. You can find more details about it in help documentation.
Provide below information in the AndroidManifest.xml file. Make sure to provide Server URL from the step 4.2 and save the changes.
XML
<?xml version="1.0" encoding="utf-8"?><manifestxmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"><application><activityandroid:name="sap.mdkclient.MDKAndroidActivity"><intent-filterandroid:autoVerify="true"><actionandroid:name="android.intent.action.VIEW"/><categoryandroid:name="android.intent.category.DEFAULT"/><categoryandroid:name="android.intent.category.BROWSABLE"/><dataandroid:scheme="https"/><dataandroid:host="<enter Server URL without https:// from step 4.2>"/><dataandroid:pathPrefix="/mobileservices/deeplinks"/></intent-filter></activity></application></manifest>
The intent files will map URLs from your website to activities to your MDK Client so the OnLinkDataReceived event can be triggered. See here for more information.
Provide below information in the app.entitlements file. Make sure to provide Server URL from the step 4.2 and save the changes.
XML
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plistversion="1.0"><dict><key>aps-environment</key><string>development</string><key>com.apple.developer.associated-domains</key><array><string>applinks:<enterServerURLwithouthttps://fromthestep4.2></string></array><key>com.apple.security.app-sandbox</key><true/><key>com.apple.security.network.client</key><true/></dict></plist>
Provide below information in the build.xcconfig file. Make sure to provide same Apple Team ID that you entered in Mobile Services Apple Universal Links configuration.
XML
// Specify the Team since Universal links are specific to the Team / Bundle ID configured in Mobile Services
DEVELOPMENT_TEAM = <YourTeamID>
Make sure you are choosing the right device platform tab above.
In this step, you will run your branded MDK client on an Android emulator. Before trying to launch the client on Android emulator, make sure that you have already configured a virtual device (Android Studio>Virtual Device Manager). Otherwise, you may get an error like No emulator image available for device identifier. In terminal or command line window, navigate to the app name folder DemoSampleApp (in MDClient_SDK path) and use tns run android --emulator command to run the MDK client on the Android emulator.
MDK
To run the MDK client on Android device, first attach your device to your machine. Then run tns device android command to print a list of attached devices. Copy the Device Identifier value for your device.MDKMake sure Developer option and USB debugging option is enabled in android device. Then run tns run android --device <device identifier> command to launch the MDK client on your Android device.MDK
Once, above command gets successfully executed, you will see new MDK client up and running in Android simulator.
Tap Agree on End User License Agreement.
MDK
In Welcome screen, tap Start to connect MDK client to SAP Business Technology Platform (BTP).
MDK
Enter your BTP E-Mail, ID or Login Name to continue.
MDK
Enter your password to login to SAP Business Technology Platform (BTP). If you see an Universal ID screen, enter your Universal ID password.
MDK
Choose a passcode with at least 8 characters for unlocking the app and tap Next.
MDK
Confirm the passcode and tap Done.
MDK
You have the option to enable Biometric Authentication for faster access to app data. Provide your biometric information.
MDK
Tap Next. If you want your MDK client to send you notifications, tap Allow, otherwise, tap Don’t allow.
MDKMDK
Tap Now to update the client with new MDK metadata.
MDK
After you accept app update, you will see Customers and Products buttons on the Main page. You can navigate to list-detail page.
MDK
In this step, you will run your branded MDK client on an iOS simulator. In terminal window, navigate to the app name folder DemoSampleApp (in MDClient_SDK path) and use tns run ios --emulator command to run the MDK client on the iOS simulator.
MDK
To run the MDK client on iOS device, first attach the device to your Mac. Then run tns device ios command to print a list of attached devices. Copy the Device Identifier value for your device.MDKThen run tns run ios --device <device identifier> command to launch the MDK client on your iOS device.MDK
You can also Run the Project in Xcode. Open the project in Xcode with the command open platforms/ios/<app name>.xcworkspace, or open the workspace using the File -> Open... dialog in Xcode. Configure the application’s code signing settings, then Run the project for the target device.
Once, above command gets successfully executed, you will see new MDK client up and running in iOS simulator.
Tap Agree on End User License Agreement.
MDK
Tap Start to connect MDK client to SAP Business Technology Platform (BTP).
MDK
Enter your BTP E-Mail, ID or Login Name to continue.
MDK
Enter your password to login to SAP Business Technology Platform (BTP). If you see an Universal ID screen, enter your Universal ID password.
MDK
Choose a passcode with at least 8 characters for unlocking the app and tap Next.
MDK
Confirm the passcode and tap Done.
MDK
Optionally, you can enable biometric authentication to get faster access to the app data.MDK
Tap Now to update the client with new MDK metadata.
MDK
After you accept app update, you will see Customers and Products buttons on the Main page. You can navigate to list-detail page.
MDK
Step 8Test the Deep Links
+
Make sure you are choosing the right device platform tab above.
In a real-world use case, you would click on a link from external sources such as webpage, email, or another app. This action will launch your MDK client and enable tasks such as navigating to a page, filtering a list based on a parameter, or approving a request.
For this tutorial, to test the deep links, you will download an index.html on your local machine and place it in your device’s file system.
Download a zip file from here on your local machine and unzip it on your machine.
Open the index.html in a text editor and update the values for <Server URL> and <Enter a Product ID>.
MDK
Server URL: Open SAP Mobile Services UI, click Mobile Applications→Native/MDK→ click myapp.mdk.demo app. Click the APIs tab. Copy the Server URL.
Product ID: In SAP Mobile Services UI, click the APIs tab →Connectivity→ click on Launch In Browser icon for com.sap.edm.sampleservice.v4 destination.MDKA new tab opens in the browser. Remove ?auth=uaa and add /Products to view product list. Copy any ProductId and paste it in the index.html.MDK
Save the changes. The index.html should look like below.
MDK
Drag & Drop the index.html to Files app on your Android emulator.
MDK
If you are running your client on your device, use Android File Transfer or any equivalent way to add the file in the device’s file system.
Click on the file and open it in Chrome browser. Clicking on the
Open Product Details via Application Link: navigates to product details page via Android App Links
Search for Product Mice via Application Link: navigates to product list page, the list with Mice Category via Android App Links
Open Product Details via URL Scheme: navigates to product details page via your branded client’s URL scheme
Search for Product Mice via URL Scheme: navigates to product list page, the list with Mice Category via your branded client’s URL scheme
MDK
Download a zip file from here on your local machine and unzip it on your machine.
Open the index.html in a text editor and update values for <Server URL> and <Enter a Product ID>.
MDK
Server URL: Open SAP Mobile Services UI, click Mobile Applications→Native/MDK→ click myapp.mdk.demo app. Click the APIs tab. Copy the Server URL.
Product ID: In SAP Mobile Services UI, click the APIs tab →Connectivity→ click on Launch In Browser icon for com.sap.edm.sampleservice.v4 destination.MDKA new tab opens in the browser. Remove ?auth=uaa and add /Products to view product list. Copy any ProductId and paste it in the index.html.MDK
Save the changes. The index.html should look like below.
MDK
Drag & Drop the index.html to Files app on your iOS emulator and save it.
Share feedback on this tutorial or join the conversation in SAP Community.
Submit detailed feedbackDiscuss in Community
Steps
Step 1 of 8
1. Create a New Project Using SAP Build2. Configure the Project Using Storyboard3. Add logic to handle deep linking4. Deploy the Project5. Configure Application Links in SAP Mobile Services6. Create Your Branded MDK Client7. Run the MDK Client8. Test the Deep Links
Joule
AI Notice
Joule is an AI assistant. Generative AI may produce inaccurate, incomplete, or biased information. Always verify important details before acting on them.
Conversations are sent to SAP-hosted large language models for processing. Do not include personal data, credentials, or confidential information in your messages.
Joule's responses are based on the SAP tutorial catalog and may not reflect the latest product changes. For authoritative guidance, consult the linked tutorials and official SAP documentation.