Android Data Persistence: SharedPreferences vs Room vs DataStore > 자유게시판

본문 바로가기
  • 메뉴 준비 중입니다.

사이트 내 전체검색

뒤로가기 자유게시판

Android Data Persistence: SharedPreferences vs Room vs DataStore

페이지 정보

작성자 Rodger 작성일 26-07-29 12:26 조회 1 댓글 0

본문


Android data persistence options serve different use cases. SharedPreferences stores key-value pairs for simple settings. It's synchronous, blocking the calling thread. with large data sets. Room provides SQLite abstraction with compile-time query verification. Handles complex data with relationships, indexes, and migrations. Entity classes define database tables. DAO interfaces define data access operations. Flow and LiveData return reactive query results. DataStore replaces SharedPreferences with two implementations. Preferences DataStore stores key-value pairs with asynchronous API. Proto DataStore stores typed objects with Protocol Buffers. DataStore uses Flow for reactive data observation. DataStore handles data corruption automatically. Room is for structured data with query needs. DataStore is for simple key-value or typed preferences. SharedPreferences is legacy and not recommended for new apps. Thread safety differs: SharedPreferences is blocking, others are not. Migration path from SharedPreferences to DataStore is documented. For complex app data, Room is the standard. For simple preferences, DataStore is the modern choice.

댓글목록 0

등록된 댓글이 없습니다.

Copyright © 소유하신 도메인. All rights reserved.

사이트 정보

회사명 : 회사명 / 대표 : 대표자명
주소 : OO도 OO시 OO구 OO동 123-45
사업자 등록번호 : 123-45-67890
전화 : 02-123-4567 팩스 : 02-123-4568
통신판매업신고번호 : 제 OO구 - 123호
개인정보관리책임자 : 정보책임자명

PC 버전으로 보기