DataStore offers a more modern way of storing local data. You should use DataStore instead of SharedPreferences. Read the
DataStore guide for more information.
Overview of shared storage
Stay organized with collections
Save and categorize content based on your preferences.
Use shared storage for user data that can or should be accessible to other apps
and saved even if the user uninstalls your app.
Android provides APIs for storing and accessing the following types of shareable
data:
- Media content: The system provides standard public directories for these
kinds of files, so the user has a common location for all their photos, another
common location for all their music and audio files, and so on. Your app can
access this content using the platform's
MediaStore
API.
- Documents and other files: The system has a special directory for
containing other file types, such as PDF documents and books that use the EPUB
format. Your app can access these files using the platform's Storage Access
Framework.
- Datasets: On Android 11 (API level 30) and higher, the system caches
large datasets that multiple apps might use. These datasets can support use
cases like machine learning and media playback. Apps can access these shared
datasets using the
BlobStoreManager
API.
For more information about these APIs, see the following guides:
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2023-03-13 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2023-03-13 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 2023-03-13 UTC."]]