You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting contacts takes a lot of time. It takes 10-12 seconds for me.
If someone wants only name and phone number it shouldn't be that slow. I've implemented it for android but don't know how to do it for iOS.
val selection = ContactsContract.Contacts.HAS_PHONE_NUMBER
var cursor = applicationContext.contentResolver.query(uri, arrayOf(ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME, ContactsContract.CommonDataKinds.Phone._ID, ContactsContract.Contacts._ID), selection, null, ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME + " ASC")
cursor!!.moveToFirst()
while (cursor.isAfterLast == false) {
val contactNumber = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))
val contactName = cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME))
val phoneContactID = cursor.getInt(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone._ID))
val contactID = cursor.getInt(cursor.getColumnIndex(ContactsContract.Contacts._ID))
cursor.moveToNext()
}
cursor.close()
The text was updated successfully, but these errors were encountered:
Getting contacts takes a lot of time. It takes 10-12 seconds for me.
If someone wants only name and phone number it shouldn't be that slow. I've implemented it for android but don't know how to do it for iOS.
The text was updated successfully, but these errors were encountered: