Running Your Application on a Mobile Device or Simulator (Magic xpa 3.x)
The mobile RIA client provides a simple interface to run your application on a mobile device without the need to compile and sign the code after each change in the application’s execution properties. This method is for use during the development phase for testing purposes only. For deployment, you must create your own custom application as described at Customizing Your Application.
|
To see a video demonstration about running your application on Android, click here.
|
To test your Magic xpa application, follow these steps:
-
Start your Magic xpa server.
Run your application on a Magic xpa server (either by pressing Ctrl+F7 from the Studio or directly by starting the Runtime engine). Note that the Deployment mode environment setting must be set to Background. It must run in Background mode in order to handle requests from the mobile RIA client.
-
Create a text file containing the execution settings for your application.
|
|
<properties>
<property key="protocol" val="http"/>
<property key="server" val="192.168.137.1"/>
<property key="requester" val="MagicScripts/MGrqispi.dll"/>
<property key="appname" val="XXX"/>
<property key="prgname" val="XXX"/>
</properties>
|
|
|
This is your IP address.
|
This is the requester’s path on the Web server.*
|
This is the name of your application.
|
This is your project’s public name.
|
|
* Make sure that the alias name (MagicScripts in this example) refers to the scripts folder.
Make sure to change the content of the other lines, such as the web server, as per your settings.
Note: A sample file, DevProps.txt, contains these lines and is located in the %EngineDir%\RIAModules\Android and %EngineDir%\RIAModules\iOS folders, so you can simply edit this file.
-
The file should have a txt extension, for example: DevProps.txt. You can rename this file.
Note: Using a different extension is possible, but you will need to define the MIME type on the server so that the mobile devices will be able to open the file.
-
Compile the application using your signing certificate or provisioning file as described later on. Magic xpa comes with a compiled application, which you can use. It is located at: %EngineDir%\RIAModules\Android\MagicDev.APK.
-
Install the application on your mobile device or simulator.
-
After installing and running the application, a pop-up dialog box will open. In this dialog box, you need to enter a URL referring to the execution properties file on your Web server as defined above, for example: http://192.168.137.1/MagicRIAApplications/DevProps.txt.
-
Click OK to run your application.
Note:
-
Once you complete the steps above, running the application on your mobile device will load the connection settings defined in the URL you entered.
-
Any change you make in these settings will apply automatically when you run the application on your mobile device. This is so you can easily change the execution settings, such as the public name of the program, without having to reinstall the application on the mobile device.
-
Make sure that the mobile device has access to this URL. In most cases, the development server is not exposed to the outside world. In these cases, the mobile device should be connected to the same network as the development server using WiFi. You can easily check it out by opening a browser and using the address as the URL. You should see the file’s content.
-
To change the URL, you need to:
-
For Android devices: Change the URL in the Android device’s built-in Accounts list. Note that the account detail screen also shows syncing capabilities. These capabilities are not supported and will not affect the application.
Only apps with a URL="" string in the execution properties will appear in the Android Accounts list.
-
For iOS devices: Change the URL in the iOS device's settings.
Only apps with a URL="" string in the execution properties will appear in the iOS Settings list.
Note that if you compile the client using Xcode and not by running the build.sh command, then in order to see the application in the Settings screen, you need to do the following from Xcode:
From the File menu, select Add Files to “MagicApp”. In the opened dialog box, select the Settings.Bundle folder and click Add.
It is also possible to use a generic application installed on your device and provide the URL as an argument. (Since version: 3.1)
The launch of the application with different configurations will be done by using an HTML launcher site with the following link:
<a href="magic://?URL=http://192.168.137.1/MagicRIAApplications/DevProps.txt"> Start My App </a >
where magic is the app name and http://192.168.137.1/MagicRIAApplications/DevProps.txt is the location and name of the properties file.
When the application is launched on the client, if the execution.properties file in the application does not contain any connection details, then the URL value supplied in the link will be used to retrieve the execution details. This value will also be stored as if the end user wrote it in the Settings screen.
This functionality allows you, for example, to compile and install one application on the client and run different applications via a portal page that starts this client application each time with a different URL.