User Data
Store and manage player data to enhance gameplay experience and retain progress.
There are two types of storage: local_storage and platform_internal. When writing to local storage, data is saved on the player's device. When writing to internal storage, data is saved on the platform's servers.
To use platform STORAGE_TYPE you need to import type from playgama-bridge.ts.
import { VISIBILITY_STATE,BANNER_STATE, INTERSTITIAL_STATE, REWARDED_STATE, STORAGE_TYPE, PLATFORM_MESSAGE, ACTION_NAME, EVENT_NAME, BANNER_POSITION } from '../../extensions/playgama-bridge/playgama-bridge.ts';In example above, we import all types from the file, but in your file you can import only STORAGE_TYPE.
If you need to call storage methods in a sequence, make sure you wait for previous call to finish, so there is no potential data collisions.
await bridge.storage.set('key', 'value', storageType)
const data = await bridge.storage.get('key', storageType)
// OR
bridge.storage.set('key', 'value' storageType)
.then(() => bridge.storage.get('key', storageType))
.then((data) => {
//
})Consider using arrays parameters to save, retrieve, or delete data for multiple keys.
const [data1, data2] = await bridge.storage.get(['key1', 'key2'], storageType)Current Storage Type
Identify the default storage type to understand where data is being saved (local or server).
Possible values: local_storage, platform_internal.
Support Check
Verify if the specified storage type is supported on the platform to ensure compatibility.
Availability Check
Check if the specified storage type is currently available for use to manage data storage effectively.
Load Data
Load DataRetrieve stored data based on a key or multiple keys to restore player progress or settings.
Save Data
Save DataSave data to the specified storage with a key to retain player progress or settings.
Delete Data
Remove data from the specified storage by key to manage player data and settings effectively.
All data operations interact with the current platform storage. You can specify the storage type as the second argument. Ensure the storage is available before using it.
Last updated