data

Room ORM, SQLite, SharedPreferences, DataStore, encryption.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "data" with this command: npx skills add pluginagentmarketplace/custom-plugin-android/pluginagentmarketplace-custom-plugin-android-data

Data Persistence Skill

Quick Start

Room Entity & DAO

@Entity
data class User(@PrimaryKey val id: Int, val name: String)

@Dao
interface UserDao {
    @Query("SELECT * FROM User")
    suspend fun getAllUsers(): List<User>
    
    @Insert
    suspend fun insert(user: User)
}

EncryptedSharedPreferences

val prefs = EncryptedSharedPreferences.create(context, "secret",
    MasterKey.Builder(context).setKeyScheme(AES256_GCM).build(),
    AES256_SIV, AES256_GCM)

prefs.edit { putString("token", value) }

DataStore

val dataStore = context.createDataStore("settings")
val preferences = dataStore.data.map { it[KEY] ?: "" }

Key Concepts

Room Advantages

  • Type-safe queries
  • Compile-time checks
  • Suspend/Flow support
  • Migration management

SharedPreferences

  • Simple key-value store
  • Use Encrypted version for sensitive data
  • Limited to small data

DataStore

  • Modern SharedPreferences
  • Coroutine-native
  • Type-safe
  • ACID transactions

Best Practices

✅ Use Room for complex data ✅ Encrypt sensitive data ✅ Implement proper migrations ✅ Handle database errors ✅ Test database operations

Resources

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

production

No summary provided by upstream source.

Repository SourceNeeds Review
Automation

platform

No summary provided by upstream source.

Repository SourceNeeds Review