Module: Toybox.Application.Storage
Overview
The Storage module provides persistent storage to applications.
Storage provides access to persistent disk storage.
Typedef Summary collapse
- KeyType as Lang.Number or Lang.Float or Lang.Long or Lang.Double or Lang.String or Lang.Boolean or Lang.Char
- ValueType as Lang.Number or Lang.Float or Lang.Long or Lang.Double or Lang.String or Lang.Boolean or Lang.Char or Lang.ByteArray or Graphics.BitmapReference or WatchUi.BitmapResource or WatchUi.AnimationResource or BluetoothLowEnergy.ScanResult or Complications.Id or WatchFaceConfig.Id or Lang.Array<Storage.ValueType> or Lang.Dictionary<Storage.KeyType, Storage.ValueType> or Null
Instance Method Summary collapse
-
clearValues() as Void
Clear the object store for the application.
-
deleteValue(key as Storage.KeyType) as Void
Delete the given key from the object store.
-
getValue(key as Storage.KeyType) as Storage.ValueType
Get the data associated with a given key from the object store.
-
setValue(key as Storage.KeyType, value as Storage.ValueType) as Void
Store the given data in the object.
Typedef Details
KeyType as Lang.Number or Lang.Float or Lang.Long or Lang.Double or Lang.String or Lang.Boolean or Lang.Char
ValueType as Lang.Number or Lang.Float or Lang.Long or Lang.Double or Lang.String or Lang.Boolean or Lang.Char or Lang.ByteArray or Graphics.BitmapReference or WatchUi.BitmapResource or WatchUi.AnimationResource or BluetoothLowEnergy.ScanResult or Complications.Id or WatchFaceConfig.Id or Lang.Array<Storage.ValueType> or Lang.Dictionary<Storage.KeyType, Storage.ValueType> or Null
Instance Method Details
clearValues() as Void
Clear the object store for the application.
deleteValue(key as Storage.KeyType) as Void
Delete the given key from the object store.
getValue(key as Storage.KeyType) as Storage.ValueType
Get the data associated with a given key from the object store.
Values must first be set with
setValue() before they are
can be obtained with getValue.
Symbols can change from build to build and are not to be used for for Keys or Values
setValue(key as Storage.KeyType, value as Storage.ValueType) as Void
Store the given data in the object.
Support for storing object types has been expanded over time.
-
BitmapResource (Since 3.0.0)
-
AnimationResource (Since 3.0.8)
-
ScanResult (Since 3.2.0)
-
Complications.Id (Since 4.2.0)
-
WatchFaceConfig.Id (Since 5.1.0)
There is a limit on the size of the Object Store that can vary between devices. If you reach this limit, the value will not be saved and an exception will be thrown. Also, values are limited to 32 KB in size.
Symbols can change from build to build and are not to be used for for Keys or Values