Storage interface
Stay organized with collections
Save and categorize content based on your preferences.
Methods for persisting game and save data.
Methods
clear()
Removes all key-value pairs, if there are any.
getItem(key)
Returns the current value associated with the given key, or null if the given
key does not exist.
removeItem(key)
Removes the key-value pair with the given key, if a key-value pair with the
given key exists.
setItem(key, value)
Sets the value of the pair identified by key to value, creating a new key-value
pair if none existed for key previously.
Requirements
- Your game must use this interface to save progress when users have made
material progress such as completing a level.
- Your game must restore any saved progress when the game starts.
- Your game must be able to restore saved progress from previous versions
of the game.
- The total size of saved game must be less than 3 MiB and should be
less than 500 KiB.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-03 UTC."],[[["Games must utilize the provided interface (`clear()`, `getItem()`, `removeItem()`, `setItem()`) for saving player progress, especially upon significant events like completing a level."],["Games are required to automatically load and apply any saved progress when launched, ensuring continuity for the player."],["Saved game data must be compatible with prior game versions, allowing players to seamlessly continue progress from older builds."],["All saved game data for a user should not exceed 3 MiB in total size, and ideally be kept under 500 KiB to optimize storage space and loading times."]]],[]]