Where information lives on device.
WHAT OPTIONS EXIST
Key-value preference storage, for small settings A local database, for structured data Files, in application-private or shared storage Secure storage, for sensitive values
WHAT TO USE FOR SETTINGS
The modern preference library, which is asynchronous and type-safe.
WHAT TO USE FOR STRUCTURED DATA
The database library, with defined entities and queries.
WHY
Queries are verified at build time, and migrations are managed.
WHAT MIGRATIONS ARE
Defined changes to the database structure between versions.
WHY THEY MATTER
Users upgrade with existing data, and an unhandled change crashes or loses it.
WHAT TO TEST
Upgrading from the previous released version, with real data.
WHAT SCOPED STORAGE MEANS
Restricted access to shared storage, with your application confined to its own area.
WHAT THAT AFFECTS
Reading and writing user files, which requires specific mechanisms.
WHAT TO NEVER STORE UNENCRYPTED
Credentials, tokens, keys, personal data.
WHAT TO USE INSTEAD
The platform's secure storage, backed by hardware where available.
WHAT TO ASSUME
That a device may be rooted, and private storage readable.