Skip to main content

Local Data for Android Developers

Local data on Android is information stored on the device so the app works offline and remembers settings. Room provides a typed SQLite layer with entities, DAOs and migrations, DataStore holds small key-value or typed preferences, and files or encrypted storage handle documents and sensitive values.

Stage: Data and Networking · Part of the Android Developer roadmap · Last reviewed 19 November 2026

What to learn in Local Data

Local Data interview questions

When should you use DataStore instead of Room?

Use DataStore for small, simple data such as settings, flags or a signed-in user id, where you read and write whole values. Use Room when you have many records, relationships, filtering or sorting needs. DataStore is asynchronous and built on coroutines and Flow, unlike the old SharedPreferences.

Why must Room queries not run on the main thread?

Disk access can take long enough to freeze the UI and trigger an Application Not Responding dialog, so Room throws an exception for main thread queries by default. Declaring DAO methods as suspend functions or returning Flow makes Room run them on a background executor.

Where Local Data fits in the Android Developer roadmap

Local Data belongs to the Data and Networking stage (beginner level), which takes about 5 hours. Storage and APIs.

Back to the full Android Developer roadmap