Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting contacts is very slow #70

Closed
sharansingh00002 opened this issue Dec 23, 2019 · 1 comment
Closed

Getting contacts is very slow #70

sharansingh00002 opened this issue Dec 23, 2019 · 1 comment

Comments

@sharansingh00002
Copy link

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()
@lukasgit
Copy link
Owner

@sharansingh00002 should resolved now.. please upgrade to 0.4.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants