Mobile Application Life Cycle

The Mobile application has two parts – the client-side mobile application and server-side back-end DataService service.

Main Mobile Application Life Cycle

The table in this topic details the steps performed while an XAF Mobile application is running.

Stage

Description

Ways to Customize

AppPlayer starts

A user runs the mobile application on a Simulator or a mobile device. See the Client-side Mobile Application Creation Cycle section.

Use the MobileApplication.GetAppPlayerModel method to get the Views Info.

Use the MobileApplication.SetLogonParametersForUIBuilder method to set the user's login information for whom the View Info is created.

The View Info requests data for a View or a user executes an Action

Mobile application makes an HTTP-request to the DataService service.

$global.ServiceUrl

DataService processes the request

See the Back-End DataService Life Cycle section.

Mobile application receives response

Data from the response is displayed in a View or used to change the user interface (for example, to update Actions or layout element visibility).

Mobile application works until a user closes it

A user can close the application started in the simulator by closing the browser window.

Client-side Mobile Application Creation Cycle

The AppPlayer JavaScript library starts and initializes with the Frames Info, which is the client-side representation of XAF Frames. It can be started in the following ways:

  • In simulator

    When you run the mobile application in the simulator, the Views Info (the client-side representation of XAF Views) requested from the MetadataService service.

  • On the mobile screen

    The mobile application installed on a mobile device is already packed with the Views Info when clicking Build Application for Mobile in the simulator creates the zip-file for PhoneGap Build.

Note

The generated client application is static; only data transfers to the client. This restricts Mobile UI runtime customization but reduces network traffic and server-side calculations.

Back-End Data Service Life Cycle

The DataService.svc file contains the OData back-end service, which inherits from the MobileDataService and WCF Data Service. This service uses MobileApplication internally, as described below.

Stage Description Ways to Customize
A request is received A new DataService service instance starts. It creates and sets up the MobileApplication internally. Inherit the DataService.OnStartProcessingRequest.
The request is authenticated An end-user is authenticated using SecuritySystem from MobileApplication. Inherit the DataService.OnAuthenticate.
A response is composed and sent to the client The DataService service accesses data using MobileApplication.ObjectSpaceProvider and sends the response to the client-side. Inherit the XpoDataServiceV3.GetQueryInterceptor or XpoDataServiceV3.ChangeInterceptor.
Dispose The DataService service and MobileApplication are stopped (fully disposed).