Query contacts independently of Account using AndroidAddressBook


  • I would like to query the list of AndroidContact using a subclass of AndroidAddressBook, but independent of any associated Account, like so.

    val contacts = myAddressBook.queryContacts(null, null)
    

    Now this is very difficult because account name and type are set in final method AndroidAddressBook.syncAdapterURI(Uri), that many parts of that functionality rely on.

    I would love this method to either be open or have the address book support another way to perform Account independent operations. A simple open would allow me to change the functionality like so, giving me exactly the results I need.

    override fun syncAdapterURI(uri: Uri) = uri
    

    What are your thoughts?

  • developer

    Hi,

    AndroidAddressBookis designed to access raw contacts, which should always be bound to an account.

    Do you want to access contacts or raw contacts? What is your use case?


  • I misunderstood indeed. I was in fact looking for the device’s (default) account name and type that stores local accounts. I solved this issue now. Thank you!

Similar topics