diff --git a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt index e07326b0..8e178531 100644 --- a/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt +++ b/app/src/main/kotlin/com/simplemobiletools/contacts/pro/helpers/ContactsHelper.kt @@ -91,13 +91,20 @@ class ContactsHelper(val context: Context) { } private fun getContentResolverAccounts(): HashSet { - val uri = ContactsContract.Data.CONTENT_URI + val sources = HashSet() + arrayOf(ContactsContract.Groups.CONTENT_URI, ContactsContract.Settings.CONTENT_URI, ContactsContract.RawContacts.CONTENT_URI).forEach { + fillSourcesFromUri(it, sources) + } + + return sources + } + + private fun fillSourcesFromUri(uri: Uri, sources: HashSet) { val projection = arrayOf( ContactsContract.RawContacts.ACCOUNT_NAME, ContactsContract.RawContacts.ACCOUNT_TYPE ) - val sources = HashSet() var cursor: Cursor? = null try { cursor = context.contentResolver.query(uri, projection, null, null, null) @@ -118,8 +125,6 @@ class ContactsHelper(val context: Context) { } finally { cursor?.close() } - - return sources } private fun getDeviceContacts(contacts: SparseArray) {