For the complete documentation index, see llms.txt. This page is also available as Markdown.

Contacts SDK

An Android SDK for reading device contacts with Ethereum (ETH) address and ENS name support. Built for the ethOS ecosystem.

ETH addresses are stored in the DATA15 field of Android's ContactsContract, and ENS names are stored in SharedPreferences — the same convention used by the ethOS Contacts app.

Setup

1. Add JitPack repository

In your root settings.gradle.kts:

dependencyResolutionManagement {
    repositories {
        // ...
        maven { setUrl("https://jitpack.io") }
    }
}

2. Add the dependency

In your module build.gradle.kts:

dependencies {
    implementation("com.github.EthereumPhone:ContactsSDK:0.1.0")
}

3. Add permissions

Add to your AndroidManifest.xml:

Make sure to request these permissions at runtime on Android 6.0+.

Usage

Initialize

Get all contacts

Get contacts with ETH addresses only

Get contacts with ENS names only

Get contacts with any Ethereum data (ETH address or ENS)

Get a specific contact by ID

Write an ETH address to a contact

Write an ENS name to a contact

Add a new contact with ETH data

Contact Model

Helper properties:

  • contact.hasEthAddresstrue if the contact has a valid ETH address

  • contact.hasEnstrue if the contact has an ENS name

How ETH data is stored

This SDK uses the same storage convention as the ethOS Contacts app:

Data
Storage Location

ETH Address

ContactsContract.Data.DATA15 under StructuredName MIME type

ENS Name

SharedPreferences with key "ENS_{contactId}" in "contact_prefs" file

If DATA15 contains a valid ETH address (0x + 40 hex chars), it's parsed as an ETH address. Otherwise, if it contains a dot (e.g., vitalik.eth), it's treated as an ENS name.

Github Repo:

Last updated