Packaging for a mobile device
Before you deploy an application to a mobile device, you must package the files into an .aab or .apk file (for Android™ devices) or an .ipa file (for iOS devices).
Creating a package for a mobile platform follows the general packaging procedure, with additional planning as outlined below.
When you build the package, an .aab or .apk file (for Android devices) or an .ipa file (for iOS devices) is created. It is saved to the Distribution directory specified in the Package node. The file name is taken from the package node name. The default distribution directory is $(ProjectDir)/distbin.
Move files into a writable directory
If you have writable files that need to be updated by the app (such as database files), those files must be placed into a read-write directory on the device.
Create the user database
In addition to simply copying writable files, one of the first things your app needs to do is create the user database in a writable directory. This database may use the initial database file when creating the user database, or it may create one with a different schema for the user.
For an example, open the
OfficeStoreMobile demo project, open the
OrdersApp.4gl intermediate file, and look for the
OrdersApp_install
function. In this function, the
os.Path.copy
method is used to copy a database file from the
read-only source directory to the read-write destination directory.
Package node properties
The properties of the Package node have specific functions for mobile packages:
- The ID property must conform to platform-specific
standards.
- Android packages require Android application IDs. See Set the application ID (Android developer site).
- iOS packages require IDs that conform to the format of the bundle identifier for Apple apps. See CFBundleIdentifer (Apple developer site).
- The Label property becomes the app name.
- The Version property has platform-specific
requirements.
- Android version numbers must conform to the standards for Android versioning. See Version your app (Android developer site).
- For iOS packages, the version number must be incremented each time you submit a new version to the Apple® AppStore.
- Use the Android package properties to choose colors and icons, to set permissions for the Android package, and to specify Cordova Plugins.
- Use the iOS package properties to specify the launch screen, the application icon, and any Cordova Plugins.
Manage your updates
When you create a new version of the app, you need to manage your app updates.
Embed a custom GBC client
- Set GBC_USER_DIR to the directory path containing your compiled GBC customizations.
- Set GBC_USER to the name of the GBC customization folder or to the name of the GBC runtime package zip file. Either the folder or the file must be located in the directory specified by GBC_USER_DIR.
For more detail regarding the Universal Rendering environment set, see Configure for a GUI client.
Additional considerations for Android
- You need an internet connection the first time you build an Android package. During this first build, an automated process downloads and installs Gradle with all necessary extensions into a directory in your user directory. See http://www.gradle.org for more information about the Gradle project automation tool.
- To use a specific GBC customization, ensure you have:
- Specified a Universal Rendering environment set and set GBC_USER_DIR and GBC_USER.
- Placed the GBC runtime package (a zip file sharing the same name as GBC_USER) into the folder specified by GBC_USER_DIR.
- The packaging of a GMA application is handled under the covers by the gmabuildtool, which uses a cache. This cache is created in a temporary directory and, if not managed, can grow to a significant size. You should take care to monitor the size of this cache and manually clean out the cache files, to ensure that it does not become too large in size. For more information about the gmabuildtool and the cache it creates, see the Genero Business Development Language User Guide.
- See also Troubleshooting Android packaging issues.
Additional considerations for iOS
- Read about the GMIUSERDIR environment variable, to determine whether it should be set for your package.
- The packaging of a GMI application is handled under the covers by the gmibuildtool. For more information about the gmibuildtool, see the Genero Business Development Language User Guide.