cancel
Showing results for 
Search instead for 
Did you mean: 

SAP MDK: How to add Deep Link to my build application?

pascal_ducaule
Explorer
0 Kudos

Hi,

I would like to be able to open my Mobile Service built application using some android link such as the one below

mdkclient://sap.com?ProductId=123

I found the doc explaining how to consume it using the OnLinkDataReceived event (https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/features/fiori-ui/mdk/deep-link.html)

My question is: How to I "enable/register" this mdkclient scheme using the SAP MDK SDK?

i.e. How do I "Create an Intent Filter in the Manifest" using SAP MDK as explained below

https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/features/applic...

Thanks

Accepted Solutions (0)

Answers (4)

Answers (4)

robbewuyts
Explorer
0 Kudos

hi, maybe anyone of you guys that can answer my question? Launch MDK native app in Fiori web app | SAP Community

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

I ran a test using the following rule (which is essentially the same a yours)

export default function LinkDataReceived(context) {
    let linkData = context.getAppEventData();
    console.log("OnLinkDataReceived Event! " + linkData);
    return context.executeAction({
        "Name": "/DeepLink/Actions/Generic/MessageBox.action",
        "Properties": {
            "Message": "OnLinkDataReceived Event! " + linkData,
            "Title": "Deep Link Received"
        }
    });
}

on an emulator and sent the deep link via adb using the following command

adb shell am start -a android.intent.action.VIEW -d deep1://Products?id=123

The client launches (if not running) and the OnLinkDataReceived event is fired resulting in the following output.

pascal_ducaule
Explorer
0 Kudos

Thanks Bill, somehow I can't make it work...

Here is what I have done:

- updated my MDKProject.json with "UrlScheme": "myTestApp"

- deployed new version with updated code:

Application.app update:

- "OnLinkDataReceived": "/eMobilityPOC/Rules/Application/OnLinkDataReceivedHandler.js"

- OnLinkDataReceivedHandler.js code:

export default function OnLinkDataReceivedHandler(clientAPI) {
let data = clientAPI.getAppEventData();
return context.executeAction({ "Name": "/myApp/Actions/GenericToastMessage.action", "Properties": { "Message": data
} }); }

- rebuilt my app using Mobile Cloub Build feature (Customized Mobile Development Kit Client and updated with my new zipped .mdkProject folder)

- installed the built .apk on my phone

Now when i generate a QRCode with content: myTestApp://?ProductId=123 then read it (using google lens for instance) I expect this link to open my newly installed app

I may be missing something obvious though (never worked with deep link and mobile app before)

Thanks

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

The second link is not specific to MDK. The url scheme used for receiving deep links in MDK is the URLScheme defined in the MDKProject.json used to create your client. If you are running the App/Play store client then they are using sapmobilesvcs as the URL scheme. The MDK client handles the registration for the scheme automatically. You simply need to specify the OnLinkDataReceived action to get triggered when the link is sent and act accordingly.