LoadSharedVariable

Description

Loads a variable that was saved by this app, or another app. This only works on iOS, Android 9 and below, and HTML5 platforms. Apps can only share a variable if they meet certain requirements based on the platform.

On iOS the apps must have the same Bundle Seed ID (also called App ID Prefix) and have the same explicit App ID up to the last dot. For example com.mycompany.mygroup.myapp1 and com.mycompany.mygroup.myapp2 would be able to share variables.

On Android 9 and below the apps must have the WRITE_EXTERNAL_STORAGE permission and have the same package name up to the last dot. For example com.mycompany.mygroup.myapp1 and com.mycompany.mygroup.myapp2 would be able to share variables. On Android shared variables are written to a user accessible location, so be aware that users may be able to read and/or edit the variables that you save.

On Android 10 or higher this command will not work as apps are restricted from writing to shared locations.

On HTML the apps must be hosted on the same domain, the values are stored as cookies.

Variables are identified by name, so using SaveSharedVariable("username", "Alice") will set the variable called "username" to the value "Alice". This can then be read by other apps by using LoadSharedVariable( "username", "" ). If a variable with the given name doesn't exist then the specified default value is returned instead

Definition

string LoadSharedVariable( varName, defaultValue )

Parameters