ContactsHelper
Helper de contacts centralisé.
Permissions requises :
READ_CONTACTS→ lectureWRITE_CONTACTS→ création / suppression
Enregistrement Koin :
single { ContactsHelper(androidContext()) }Content copied to clipboard
Utilisation :
// Lire tous les contacts
val contacts = contactsHelper.query(ContactQuery.All)
// Chercher par nom
val results = contactsHelper.query(ContactQuery.search("Alice"))
// Sélecteur natif (pas de permission requise)
val launcher = contactsHelper.registerPickerLauncher(activity) { uri ->
uri?.let { contactsHelper.resolveContact(context, it) }
}
contactsHelper.openPicker(launcher)Content copied to clipboard
Functions
Link copied to clipboard
Crée un contact minimal (nom + téléphone). Requiert WRITE_CONTACTS.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun registerPickerLauncher(activity: FragmentActivity, onResult: (Uri?) -> Unit): ActivityResultLauncher<Void?>
Enregistre un launcher pour le sélecteur de contact natif.
Link copied to clipboard
Résout un Uri retourné par le sélecteur natif en ContactInfo.