System variables are values calculated by the app runtime, covering things like current app version or screen width. They are automatically kept up-to-date, so e.g. resizing your screen will affect systemVars.dimensions.window
, and rotating your phone will update systemVars.orientation
.
They can be accessed in formula functions under the systemVars
namespace. This means that e.g. os
below is found under systemVars.os
.
System variable | Valid values | Description |
|
| Name of the current operating system. |
|
| Device orientation. |
| Any positive integer value | Screen width, in pixels. |
| Any positive integer value | Screen height, in pixels |
| Any positive integer value | Window width, in pixels. On mobile, this is equal to screen width. |
| Any positive integer value | Window width, in pixels. On mobile, this is equal to screen width. |
| Any positive integer value | Visible viewport width excluding sidebar if exists. |
| Any positive integer value | Visible viewport height excluding navbar and topbar if exists. |
|
| Current environment. If release management is not in use, the value is always |
|
| Device form factor. |
| N/A | Covered in the Permissons reference document. |
| ​Semver version code, e.g. | Binary build version, set in the build configuration. |
| ​Semver version code, e.g. | AppGyver runtime version. |
|
| Build type. |
|
| Network status. If there is no network, or the app is running with the web runtime, then |
|
| Runtime type. |
| String value | If your app was launched from external URL that URL is registered into |
| String value | This variable represent url your app can be launched from external tool i.e. mobile browser. |
The systemVars.filesystem
object contains information about the file system of the device the app is currently running.
This information is only available on native apps, not when running on web.
The systemVars.filesystem.directories
object contains the base directory paths available on the device. Flow functions that deal with files work with absolute paths, so a pattern you will encounter is using these at the beginning of a file path constructed with a formula, e.g. systemVars.filesystem.directories.cache + "/myTempFile.jpg"
.
The following directories are available on both iOS and Android.
systemVars.fileSystem.directories.document
Local file system path to the document directory. This directory will only be emptied when the app is uninstalled, so it can be used to safely store files your app needs to function.
For example, /data/user/0/com.appgyver.agclient.debug/files
.
Under the hood on iOS, the NSDocumentDirectory
API is used. On Android, the getDataDirectory
API is used.
systemVars.filesystem.directories.cache
Local file system path to the cache directory for the app. This directory can be emptied by the operating system, so it should only be used to store temporary files.
For example, /data/user/0/com.appgyver.agclient.debug/cache
.
On iOS, the NSCachesDirectory
is used. On Android, the getCacheDir
API is used on the app context.
The directories below are only available when the app is running on an iOS device.
systemVars.filesystem.directories.ios.mainBundle
Local file system path to the main bundle directory, which contains files embedded in the iOS binary. This directory is read-only.
The directories below are only available when the app is running on an Android device.
systemVars.filesystem.directories.android.dcim
Local filesystem path to the Digital Camera Images (DCIM) directory.
systemVars.filesystem.directories.android.download
Local filesystem path to the downloads directory.
systemVars.filesystem.directories.android.music
Local filesystem path to the music directory.
systemVars.filesystem.directories.android.pictures
Local filesystem path to the pictures directory.
systemVars.filesystem.directories.android.movies
Local filesystem path to the movies directory.
systemVars.filesystem.directories.android.ringtones
Local filesystem path to the ringtones directory.
systemVars.filesystem.directories.android.sdCard
Local filesystem path to the device SD card directory.
​