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

getAllContacts only returns contacts the first time #83

Open
fpaaske opened this issue Apr 23, 2020 · 2 comments
Open

getAllContacts only returns contacts the first time #83

fpaaske opened this issue Apr 23, 2020 · 2 comments

Comments

@fpaaske
Copy link

fpaaske commented Apr 23, 2020

After updating to NativeScript 6.5 and tns-android 6.5.0, getAllContacts(["name"]) only returns contacts the first time it's called.

I tested some older versions, and for NativeScript 6.5 and tns-android 6.4.0, the same code works well.

But for NativeScript 6.5 and tns-android 6.4.1 it fails again..

@dlcole
Copy link
Contributor

dlcole commented Apr 24, 2020

Your issue prompted me to test my own app that uses getAllContacts. It works successfully on an Android emulator. Where were you seeing the problem?

tns doctor output:

✔ Component nativescript has 6.5.0 version and is up to date.
✔ Component tns-core-modules has 6.5.1 version and is up to date.
✔ Component tns-android has 6.5.0 version and is up to date.
✔ Component tns-ios has 6.5.0 version and is up to date.

BTW, I found an issue in the getContact method where the activityResult callback is called multiple times, once for each time getContact has been invoked. I have a local fix that removes the event listener upon completion and will be making a pull request. I looked at the getAllContacts method but this problem doesn't appear to exist there.

@comporell
Copy link

I have a local fix that removes the event listener upon completion and will be making a pull request.

Alternatively you can just unsubscribe the eventlistener then create a new event listener in case you don't have subscriptions.

this.contacts.contactsFound.unsubscribe(); this.contacts.contactsSaved = new EventEmitter<Object>();

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

3 participants