Problem
On Android, Ti.Contacts.getPeopleWithName only matches contacts with an exact display_name. The docs say that (and iOS behaves such that) all contacts will be returned "who have a name (first, last, middle, composite) which matches the given name". Can we expand Android to match on partial names, like "Daws" matching "Dawson Toth"?
Sample Code
The following demonstrates a query that works on iOS for me, but not on Android. If I change it to search for my full name, Dawson Toth, it correctly finds my contact information.
var win = Ti.UI.createWindow({ backgroundColor: '#fff' });
win.add(label = Ti.UI.createLabel());
win.open();
var people = Titanium.Contacts.getPeopleWithName('Daws');
for(var i = 0, l = people.length; i < l; i++) {
label.text += people[i].fullName + '\n';
}
if (people.length == 0) {
label.text = 'No people found!';
}
Tested On
Titanium SDK version: 1.7.0 (04/05/11 10:30 731db9c...)
BROKEN on Android Device Samsung Epic 4G running Android 2.2
WORKS on iPhone Simulator 4.2
The customer has submitted a pull request with fixes for this issue. https://github.com/appcelerator/titanium_mobile/pull/99
Notice the pull request.
ready for when contributor signs cla
A note re parity: I've tested (and looked at) how the iOS implementation works. It indeed matches "Daws" if, for example, the display name is "William Dawson", and that's precisely what the contributor's (David Bankier's) code gives us now in Android.
Fixed on Nexus S and Xoom with SDK 1.7.2 r3d44999e and 1.8.0 r4b694252