GitHub user jonmikelm opened a pull request:
https://github.com/apache/cordova-plugin-contacts/pull/64
Android - Filter search: Contacts with informed phone number only
When searching for all the contacts in Android, by default all the google
contacts(Gmail history, etc...) are returned. This causes performance problems
when the number of contacts is big.
Usually, we only want contacts that have a phone number informed. I have
addes a new optional boolean parameter to the options object of the "find"
method: "phoneNumberInformedOnly"
If we send true in this parameter, the where clause of the select to the
contacts database will include:
"AND (" + ContactsContract.Contacts.HAS_PHONE_NUMBER + " = 1)"
This filter is also added if a filter string is sent to the search method.
Use case:
// find all contacts with 'Bob' in any name field
var options = new ContactFindOptions();
options.multiple = true;
options.phoneNumberInformedOnly = true;
options.desiredFields = [navigator.contacts.fieldType.id];
var fields = [navigator.contacts.fieldType.displayName,
navigator.contacts.fieldType.name];
navigator.contacts.find(fields, onSuccess, onError, options);
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jonmikelm/cordova-plugin-contacts master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cordova-plugin-contacts/pull/64.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #64
----
commit 98de740287fa8b70d989d88ddc4352d76b0e295b
Author: jonmikelm <[email protected]>
Date: 2015-05-27T08:12:22Z
phoneNumbersInformedOnly
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]