aliessmael / Unity-Contacts-List

Unity Contacts List is a unity3d plugin for Android and iOS devices that enable you to access to contacts. Retreive names, phone numbers, and even photos.
42 stars 20 forks source link

Doesn't work, am I missing something ? #9

Closed AlexIndeegoGames closed 8 years ago

AlexIndeegoGames commented 8 years ago

Hi there, I had the asset store version (0.7) but it seemed to not work well on iOS so I upgraded to 0.8 from here and now it doesn't work ok my 2 Android devices either. Didn't test 0.8 on iOS yet though. My problem is pretty simple : it does not found any contact. To be fair, no callback in Contacts.cs is called : no GetContact, no OnInitializeDone, no OnInitializeFail. I don't understand how it works because those functions should be called from your MssageReceiver class but I don't understand how those MssageReceiver functions are called. Anyway, any help is welcome. Also I had a question : I didn't really understand if the loading of contacts is in a different thread or not. Same things for the photos. In the previous version, loading of photos was asynchronous but it seems to be much more easier now. So is everything asynchronous ?

Thanks a lot !

aliessmael commented 8 years ago

Opps, Look like I miss jar file commit, it is fixed now. Yea, the MssageReceiver functions are called from plugin ( jar for android, or mm for ios ), you can find the plugin code at Plugins\iOS + Plugins\Android

Loading now is in different thread, thread will collect contacts one by one and send them one by one to unity ( by using OnContactReady method ) for photo it is different now before it was loaded when the gui request to show them (no thread), but now loading does not care about gui, thread will start download every thing

AlexIndeegoGames commented 8 years ago

Thanks, it works now :) But I still have a few problems. Note that for now, I'm always testing on Android before I test on iOS.

First of all, the loading is quite long : it takes about 14 seconds to load my about 200 contacts. I think it was faster in the 0.7 version. To earn time, I'd like to load only contacts which have a phone number (for the use of my application). I guess it is possible with the "LoadInformation" function parameters, but I'm not sure how it works. And second problem : I think the source code you give is not up to date, I see that the last commit was 3 months ago. And I don't see in it any call to "OnContactReady", but the Unity function is called obviously, because it works. Also I don't see any call to OnInitializeDone and OnInitializeFail and this time, I don't see the Unity function called either.

Last thing, I think you should update your documentation, because we could think that it is possible to call Contacts.LoadContactList() and immediately iterate once on Contacts.ContactsList which is not possible anymore :)

Sorry for the long post, there are a lot of things ! Thanks for the support, anyway !

aliessmael commented 8 years ago

You welcom loading before was faster because it was not loading photos, photos loaded only when contact is visible on GUI, so loading time for old version was without photos, you can disable loading photo and compare loading time( to disable loading photo just change parameters of this line ojc.CallStatic("LoadInformation" , activity , true, true,true,true); the method in plugin is this public static void LoadInformation( Activity _activity , boolean _loadPhoto ,boolean _loadNumbers, boolean _loadEmails , boolean _loadConnections)

but yea you right it still slower ,but that is fine as it is smooth and not noticeable . for source code of jar you can decompile it using any jar decompiler ( check this for example http://jd.benow.ca/ ), but yea i will commit the last source also.

for OnInitializeDone and OnInitializeFail it is implemented for ios, to handle fails regarding permission ( user will see allow access contacts message and he may deny it), so you can handle this issue.

You welcome, if you find any other issue or suggestion feel free to raise it.

AlexIndeegoGames commented 8 years ago

Hi, just to let you know that everything is fine now :) I was making a mistake with the loading time. Actually, it's more like 5-6 seconds for my 200 contacts (some with photos) which is totally acceptable, I think. The time I saw was longer because of some "Sleep" I called by mistake. And actually, OnInitializeDone is indeed called, even in Android, when all contacts are loaded. Don't know why I missed that.

So now, everything works, on Android and on iOS, and it's quite fast ! So, thanks again for the help, and I'll let you know if I got an other issue.

Cheers !