Google is committed to advancing racial equity for Black communities. See how.

DataStore

Store data asynchronously, consistently, and transactionally, overcoming some of the drawbacks of SharedPreferences
Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release
September 2, 2020 - - - 1.0.0-alpha01

Declaring dependencies

To add a dependency on DataStore, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

dependencies {
  // Preferences DataStore
  implementation "androidx.datastore:datastore-preferences:1.0.0-alpha01"

  // Proto DataStore
  implementation "androidx.datastore:datastore-core:1.0.0-alpha01"
}

Feedback

Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.

Create a new issue

See the Issue Tracker documentation for more information.

Version 1.0.0

Version 1.0.0-alpha01

September 2, 2020

androidx.datastore:datastore-core:1.0.0-alpha01 and androidx.datastore:datastore-preferences:1.0.0-alpha01 are released. Version 1.0.0-alpha01 contains these commits.

New Features

Jetpack DataStore is a new and improved data storage solution aimed at replacing SharedPreferences. Built on Kotlin coroutines and Flow, DataStore provides two different implementations:

  • Proto DataStore, that lets you store typed objects (backed by protocol buffers)
  • Preferences DataStore, that stores key-value pairs

Data is stored asynchronously, consistently, and transactionally, overcoming most of the drawbacks of SharedPreferences.