Deploying mobile apps / Deploying mobile apps on Android devices |
Platform-specific rules need to be considered when deploying on Android devices (GMA).
On Android devices, applications are deployed in an application sandbox. The application can access and store data outside of its space, but then the data is also accessible by the other applications.
appdir/ |-- main.42m -- |-- *.42m | |-- *.42f | |-- fglprofile | | ... | |-- *.42s | |-- de/ | Program files | |-- *.42s | |-- fr/ | | |-- *.42s | |-- zh/ | | |-- *.42s | | ... | |-- ... other resource files/dirs ... | | ... | |-- webcomponents | | |-- component-type | | |-- component-type.html | | |-- other-web-comp-resource | | ... -- |-- appdata/ |-- ... writable app files ... tmpdir/ |-- ... temporary files ...
Application program files (.42m, .42f, and so on) need to be deployed in the appdir application base directory.
The FGLAPPDIR environment variable is automatically set to the appdir directory.
As with other program files, the "MAIN" module must be located under the appdir application program directory.
On Android devices, the default current working directory is the appdir directory, and can be used for writable files.
The current working directory can be found in programs with the os.Path.pwd method.
Files that need to be writable (such as SQLite database files) can be created directly under the appdir directory. However, to better organize application files, create sub-directories such as appdir/appdata, keeping original files directly under the appdir directory. For example, create the application database under os.Path.pwd() || "/database".
A temporary directory is available for the application.
In order to find the temporary directory for the app, use the standard.feInfo front call, with the "dataDirectory" parameter.
To create a temporary file name, use the os.Path.makeTempName() method.
When the app starts, the appropriate .42s string files will be loaded from the directory corresponding to the current language settings of the mobile device. String files to be loaded can be defined in app's fglprofile, or you can use the main program name to avoid fglprofile settings.
For each language supported by your application, a directory must exist under appdir, with a name including the locale codes. Consider also providing default string files (in English for ex) directly under appdir, in case if the regional settings of the device do not match one of the locale directories of the app, otherwise the application will stop with error -8006.
For example:
appdir/mystrings.42s appdir/fr/mystrings.42s appdir/de/mystrings.42s
For more details, see Localized string files on mobile devices.
If you need to set fglprofile entries for your mobile application, create a file with the name fglprofile, and deploy it under the appdir directory, along with the other program files.
See Understanding FGLPROFILE for more details about fglprofile settings.
When a mobile application starts for the first time, it typically creates a new database, or copies a existing database template file from the file directory (base.Application.getProgramDir) to the working directory (os.Path.pwd).
For more details about database creation on mobile devices, see Creating a database from programs.