System variables reference
  • 19 Oct 2022
  • 3 Minutes to read
  • Dark
  • PDF

System variables reference

  • Dark
  • PDF

Article Summary

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 variableValid valuesDescription
osandroid, ios, windows_phone, black_berry, androidtv, tvos, tizen, webos, windows, macos, unix, linux, unknownName of the current operating system.
orientationportait, landscapeDevice orientation.
dimensions.screen.widthAny positive integer valueScreen width, in pixels.
dimensions.screen.heightAny positive integer valueScreen height, in pixels
dimensions.window.widthAny positive integer valueWindow width, in pixels. On mobile, this is equal to screen width.
dimensions.window.heightAny positive integer valueWindow width, in pixels. On mobile, this is equal to screen width.
dimensions.viewport.widthAny positive integer valueVisible viewport width excluding sidebar if exists.
dimensions.viewport.heightAny positive integer valueVisible viewport height excluding navbar and topbar if exists.
envdev, prodCurrent environment. If release management is not in use, the value is always prod.
releaseEnvDevelopment, Testing, ProductionRelease environmnent information.
formFactorphone, tablet, big_screen, desktop, unknownDevice form factor.
permissionsN/ACovered in the Permissons reference document.
buildVersionSemver version code, e.g. 1.0.5Binary build version, set in the build configuration.
runtimeVersionSemver version code, e.g. 1.2.4AppGyver runtime version.
buildTypeclient, selectorBuild type. selector means the AppGyver app used to view and develop your apps.
networkStatusnone, cellurar, wifi, unknownNetwork status. If there is no network, or the app is running with the web runtime, then none is returned.
runtimeweb, nativeRuntime type.
initialUrlString valueIf your app was launched from external URL that URL is registered intoinitialUrlsystem variable.
uriSchemes.primaryString valueThis variable represent url your app can be launched from external tool i.e. mobile browser.

File system

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.

Common base directories

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.



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.



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.

iOS-only directories

The directories below are only available when the app is running on an iOS device.

Main bundle


Local file system path to the main bundle directory, which contains files embedded in the iOS binary. This directory is read-only.

Android-only directories

The directories below are only available when the app is running on an Android device.


Local filesystem path to the Digital Camera Images (DCIM) directory.


Local filesystem path to the downloads directory.


Local filesystem path to the music directory.


Local filesystem path to the pictures directory.


Local filesystem path to the movies directory.


Local filesystem path to the ringtones directory.

SD card

Local filesystem path to the device SD card directory.

Was this article helpful?