broakenmedia / MultiContactPicker

Launch a multi-select contact picker activity, useful for importing and inviting contacts to apps.
Apache License 2.0
143 stars 58 forks source link

Slow loading with multiple thousands of contacts. #27

Closed vekain closed 5 years ago

broakenmedia commented 6 years ago

Can you elaborate? If you close the picker, go into the phones contacts and add a new contact, re-opening the picker should reflect the new contact.

vekain commented 6 years ago

I mean to say that when there are 2000 or 3000 contacts available in the phonebook then while loading it starts hanging .. gets stuck to some while loop and background process and finally crashes.

broakenmedia commented 6 years ago

What type of loading are you using?

.setLoadingType(MultiContactPicker.LOAD_ASYNC)

or

.setLoadingType(MultiContactPicker.LOAD_SYNC)

It may be worth experimenting with the other mode.

vekain commented 6 years ago

I am using the default loading type .... not giving anything. Also I think while loading your repo goes into background thread and stays there forever. After long process it just says to keep the app open or close it . I think instead of loading all the contacts you should find some alternative for multiple contact picking with intent opening contacts .... previously upto Android 6.0 it was working but now it doesn't support topdown intent type.

broakenmedia commented 6 years ago

Yeah it is definitely slower than ideal due to the fact it looks up the contact number + email on the initial load along with the names. It is extremely quick to just load the contact names. In order to improve performance it would require a refactor whereby when the user taps "finish" it then does a lookup for the numbers + emails of the only the selected contacts. I don't have time to do this currently and 2-3000 contacts is very unusual, typical even the most popular people only have around 600 contacts. That said, i have tested and confirmed the picker works into the thousands of contacts you simply need to keep waiting. Usually taking a minute or two.

vekain commented 6 years ago

My client's phone has 3218 contacts and now its not working. I tried setting it to LimitColumn.PHONE and loading method to SYNC but it still takes a lot lot of time. Please tell me some method so that it loads quickly

vekain commented 6 years ago

UncaughtException: android.content.res.Resources$NotFoundException: Resource ID #0x0 at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:190) at android.content.res.Resources.getDrawable(Resources.java:878) at android.content.Context.getDrawable(Context.java:530) at android.widget.Editor$InsertionPointCursorController.getHandle(Editor.java:5320) at android.widget.Editor$InsertionPointCursorController.-wrap0(Editor.java) at android.widget.Editor.invalidateMagnifierForCursorBlinking(Editor.java:6145) at android.widget.Editor.-wrap23(Editor.java) at android.widget.Editor$Blink.run(Editor.java:2402) at android.os.Handler.handleCallback(Handler.java:836) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:208) at android.app.ActivityThread.main(ActivityThread.java:6267) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)