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

PhoneNumbers not populated #7

Open
TurhanOz opened this issue Jun 22, 2016 · 9 comments
Open

PhoneNumbers not populated #7

TurhanOz opened this issue Jun 22, 2016 · 9 comments
Labels

Comments

@TurhanOz
Copy link

Hello,

I'm making a simple query such as :

Query q = Contacts.getQuery();
List<Contact> contacts = q.find();

Some of the contacts don't have PhoneNumbers populated whereas it is filled on the System stock Contact application.
Any idea ?...
Cheers

@TurhanOz
Copy link
Author

Seems to be same as
#5

@tamir7
Copy link
Owner

tamir7 commented Jun 22, 2016

You have Contacts in your phone that don't have a phone number. If you only want to get contacts that have phone numbers, change your query to:

Query q = Contacts.getQuery();
List<Contact> contacts = q.hasPhoneNumber().find();

@TurhanOz
Copy link
Author

What I was trying to say is that even contacts that have numbers don't have the phoneNumbers list populated. The PR #5 seems to fix that.

@tamir7
Copy link
Owner

tamir7 commented Jun 22, 2016

If you run the query you've written in your first comment, you will get contacts without phone numbers. If you add hasPhoneNumber() to the query, you shouldn't get contacts without phone number.
PR #5 adds support for the old phoneNumber field. I don't use it in my code because it's not normalized and its hard to query agains it. As of API 16, there's a normalizedPhoneNumber field. It's better to work with it as all the numbers are normalized to E164 format. From API 16 the internal Contacts table has both fields.

@TurhanOz
Copy link
Author

TurhanOz commented Jul 4, 2016

Dear Tamir,

as per my previous comment, if I query with hasPhoneNumber(), some contacts won't be populated in the result even if they have phone numbers. This is certainly due to the normalized phone number field.
The PR #5 solves that by adding support to the old api.
As the mindset of open source projects, I think that even if you don't use this API on your code, it could be worth including this PR so people can choose which api to use.
Cheers

@abba-maker
Copy link

Hello tamir,

TurhanOz is right, am currently experiencing same problem where I use hasPhoneNumber() but some contacts still don't have the phoneNumber field populated even though they have phone number. It'll be great if you could add the PR as he suggested..
Thanks

@abba-maker
Copy link

Or if you can fix the problem while using the normalizedPhoneNumber, it'll be even better.

@mrbrentkelly
Copy link

Seeing the same issue. Is there a permanent fix coming for this?

@tamir7
Copy link
Owner

tamir7 commented Aug 17, 2016

Added phoneNumber field in 1.1.0
On API >= 16 you should have both phoneNumber and normalizedPhoneNumber.

@tamir7 tamir7 added the bug label Aug 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants