# LoadSharedVariable

## Description

Loads a variable that was saved by this app, or another app. This only works on iOS and Android platforms, and 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 varaibles.
On Android 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 varaibles. On Android shared variables are written to a user accesible location, so be aware that users may be able to read and/or edit the variables that you save.
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 LoadSharedVariables( "username", "" ). If a variable with the given name doesn't exist then the specified default value is returned instead

## Definition

string LoadSharedVariable( varName, defaultValue )

char* agk::LoadSharedVariable( const char *varName, const char *defaultValue )

## Parameters

- varName - The name of the variable to retrieve
- defaultValue - The value to return if the variable doesn't exist