Skip to content

Application

The Application.app file is a JSON file that contains the MDK app definition.

Application Properties

Property Type Required
EditorSetting EditorSetting No
Localization I18n No
MainPage Page Yes
OnDidUpdate ActionOrRule No
OnExit ActionOrRule No
OnLaunch complex No
OnLinkDataReceived ActionOrRule No
OnReceiveFetchCompletion ActionOrRule No
OnReceiveForegroundNotification ActionOrRule No
OnReceiveNotificationResponse ActionOrRule No
OnResume ActionOrRule No
OnSuspend ActionOrRule No
OnUnCaughtError ActionOrRule No
OnUserSwitch ActionOrRule No
OnWillUpdate ActionOrRule No
Styles Style No
Version string No
_Name string Yes

EditorSetting

Name and Path of the reference application.


Localization

Refers to any file underneath the project root's i18n folder that has a .properties extension.

Localization Example

"/_Name/i18n/i18n.properties"

MainPage

Refers to a file underneath the project root's Pages folder that has a .page extension.

MainPage Example

"/_Name/Pages/SomePage.page"

OnDidUpdate

A .action or .js file that runs with the new definitions recieved from the update. If rejected/fails, revert to previous definitions. PLT formatter is supported.


OnExit

This event is raised when the app is about to be exited. PLT formatter is supported.

OnExit Example

"$(PLT, '/MDKDevApp/Actions/PLTActions/AppEvents/OnExitIOS.action','/MDKDevApp/Actions/PLTActions/AppEvents/OnExitAndroid.action')"

OnLaunch

This event is raised when the app is launched and when user has onboarded, entered demo mode or entered passcode. PLT formatter is supported.

  • type: complex

OnLaunch Value

Any following options needs to be fulfilled.

Option 1

Option 2

Array type:

All items must be of the type:


OnLinkDataReceived

A .action or .js file that runs when the app is launched from an external link (deeplink).

The link data can be accessed via context.getAppEventData() in your event handler. It is a JS object containing the properties of URL, URLScheme, Parameters, Hash and OriginalKey. See the example below for more details.

PLT function is supported.


OnReceiveFetchCompletion

A .js file that is triggered when a remote notification arrived that indicates there is data to be fetched. For iOS, the request contains { "apns.contentAvailable": true }. For Android, the request does not contain any notification section. PLT formatter is supported.


OnReceiveForegroundNotification

A .js file that is triggered when a notification is about to be presented to the app. PLT formatter is supported.


OnReceiveNotificationResponse

A .js file that is called to let your app know which action was selected by the user for a given notification. PLT formatter is supported.


OnResume

This event is raised when the application is resumed after being suspended, for example, when the app comes back to the foreground. PLT formatter is supported.

OnResume Example

"$(PLT, '/MDKDevApp/Actions/PLTActions/AppEvents/OnResumeIOS.action','/MDKDevApp/Actions/PLTActions/AppEvents/OnResumeAndroid.action')"

OnSuspend

This event is raised when the application is suspended, for example, when the app goes into the background. PLT formatter is supported.

OnSuspend Example

"$(PLT, '/MDKDevApp/Actions/PLTActions/AppEvents/OnSuspendIOS.action','/MDKDevApp/Actions/PLTActions/AppEvents/OnSuspendAndroid.action')"

OnUnCaughtError

This event is raised when an uncaught app error is present. PLT formatter is supported.

OnUnCaughtError Example

"$(PLT, '/MDKDevApp/Actions/PLTActions/AppEvents/OnUncaughtErrorIOS.action','/MDKDevApp/Actions/PLTActions/AppEvents/OnUncaughtErrorAndroid.action')"

OnUserSwitch

This event is raised when the user is switched in Multi-User mode and all the pending Offline OData transactions from previous user are successfully synced.


OnWillUpdate

A .action or .js file that runs with the existing definitions prior to update. PLT formatter is supported.


Styles

The Styles metadata provides the client with a LESS style file used to style the controls. These are also known as built-in controls.


Version

A string, .global or .js file that returns a string representing the version of updated metadata.

  • type: string

_Name

Name of the app to be used as the base in definition reference. No space and symbols are allowed

  • type: string

Examples

// Application.app
{
  "_Name": "MDKApp",
  "MainPage": "/MDKApp/Pages/Menu.page",
  "OnLaunch": "/MDKApp/Actions/CreateService.action",
  "OnUnCaughtError": "/MDKApp/Actions/DisplayErrorMessage.action",
  "OnExit": "/MDKApp/Rules/AppExit.js",
  "OnWillUpdate": "/MDKApp/Rules/OnWillUpdate.js",
  "OnDidUpdate": "/MDKApp/Rules/OnDidUpdate.js",
  "OnSuspend": "/MDKApp/Rules/OnSuspend.js",
  "OnResume": "/MDKApp/Rules/OnResume.js",
  "OnLinkDataReceived": "/MDKApp/Rules/OnLinkDataReceived.js", 
  "Styles": "/MDKApp/Styles/Styles.css",
  "Version": "/MDKApp/Rules/MetadataVersion.js",
  "Localization": "/MDKApp/i18n/i18n.properties",
  "OnReceiveForegroundNotification": "/MDKApp/Rules/ForegroundNotificationEventHandler.js",
  "OnReceiveFetchCompletion": "/MDKApp/Rules/ContentAvailableEventHandler.js",
  "OnReceiveNotificationResponse": "/MDKApp/Rules/ReceiveNotificationResponseEventHandler.js",
  "OnUserSwitch": "/MDKApp/Actions/DisplayUserSwitchMessage.action"
}

LinkData Example

For a deeplink URL of "mdkclient://sap.com?ProductId=123&Description=New software&Verified=true#tagExample-1", the LinkData is as below.

{
  URLScheme: "mdkclient",
  URL: "sap.com",
  Parameters: {
    ProductId: "123",
    Description: "New software",
    Verified: "true"
  },
  Hash: "#tagExample-1",
  OriginalURL: "mdkclient://sap.com?ProductId=123&Description=New software&Verified=true#tagExample-1"
}