Appstate Statestore
| Bản cập nhật mới nhất | Bản phát hành ổn định | Bản phát hành dùng thử | Bản phát hành beta | Bản phát hành alpha |
|---|---|---|---|---|
| Ngày 28 tháng 10 năm 2026 | - | - | - | 1.0.0-alpha01 |
Khai báo phần phụ thuộc
Để thêm một phần phụ thuộc vào kho lưu trữ trạng thái appstate, bạn phải thêm kho lưu trữ Google Maven vào dự án. Đọc nội dung Kho lưu trữ Maven của Google để biết thêm thông tin.
Thêm các phần phụ thuộc cho cấu phần phần mềm bạn cần trong tệp build.gradle cho ứng dụng hoặc mô-đun:
Groovy
dependencies { implementation "androidx.appstate.statestore:statestore:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-android:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-datastore:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-datastore-android:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-desktop:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-iosarm64:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-iossimulatorarm64:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-js:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-linuxarm64:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-linuxx64:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-macosarm64:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-mingwx64:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-tvosarm64:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-tvossimulatorarm64:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-wasm-js:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-watchosarm32:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-watchosarm64:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-watchosdevicearm64:1.0.0-alpha01" implementation "androidx.appstate.statestore:statestore-watchossimulatorarm64:1.0.0-alpha01" }
Kotlin
dependencies { implementation("androidx.appstate.statestore:statestore:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-android:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-datastore:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-datastore-android:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-desktop:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-iosarm64:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-iossimulatorarm64:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-js:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-linuxarm64:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-linuxx64:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-macosarm64:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-mingwx64:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-tvosarm64:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-tvossimulatorarm64:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-wasm-js:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-watchosarm32:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-watchosarm64:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-watchosdevicearm64:1.0.0-alpha01") implementation("androidx.appstate.statestore:statestore-watchossimulatorarm64:1.0.0-alpha01") }
Để biết thêm thông tin về các phần phụ thuộc, hãy xem bài viết Thêm phần phụ thuộc vào bản dựng.
Ý kiến phản hồi
Ý kiến phản hồi của bạn có thể giúp chúng tôi cải thiện Jetpack. Hãy cho chúng tôi biết nếu bạn phát hiện lỗi mới hoặc có ý tưởng cải thiện thư viện này. Vui lòng xem các lỗi hiện có trong thư viện này trước khi báo một lỗi mới. Bạn có thể thêm lượt bình chọn cho lỗi hiện có bằng cách nhấp vào nút dấu sao.
Xem tài liệu về Trình theo dõi sự cố để biết thêm thông tin.
Phiên bản 1.0
Phiên bản 1.0.0-alpha01
Ngày 28 tháng 10 năm 2026
Phát hành androidx.appstate.statestore:statestore-*:1.0.0-alpha01. Phiên bản 1.0.0-alpha01 bao gồm các thay đổi sau.
Tính năng mới
AppState StateStore là một thư viện mới được xây dựng trên thời gian chạy Compose, đóng vai trò là trình bao bọc để cung cấp các tính năng tích hợp tuỳ chỉnh. Cấu phần phần mềm androidx.appstate.statestore cung cấp các API thư viện và cũng đi kèm với cấu phần phần mềm androidx.appstate.statestore:statestore-datastore để duy trì trạng thái. Nhà phát triển có thể sử dụng StateStore để đưa trạng thái ảnh chụp nhanh vào lớp ứng dụng và tích hợp kho dữ liệu để duy trì trạng thái đó.
class MyApplication : Application() {
val stateStore = StateStore()
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
override fun onCreate() {
super.onCreate()
scope.launch {
// Start the listener in a child coroutine so it doesn't block the outer scope
launch {
try {
stateStore
.syncToDataStore(dataStoreFile("settings").absolutePath, this)
} catch (e: Exception) {
e.printStackTrace()
}
}
}
}
}