Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3604] Android: Ti.Contacts.getPeopleWithName Only Matches display_name

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-06-15T10:10:20.000+0000
Affected Version/sRelease 1.6.0
Fix Version/sSprint 2011-24, Release 1.7.2, Release 1.8.0
ComponentsAndroid
Labelsn/a
ReporterDawson Toth
AssigneeBill Dawson
Created2011-04-18T08:38:58.000+0000
Updated2011-07-07T19:14:43.000+0000

Description

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

Comments

  1. Dawson Toth 2011-05-24

    The customer has submitted a pull request with fixes for this issue. https://github.com/appcelerator/titanium_mobile/pull/99
  2. Don Thorp 2011-06-01

    Notice the pull request.
  3. Bill Dawson 2011-06-10

    ready for when contributor signs cla
  4. Bill Dawson 2011-06-15

    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.
  5. Eric Merriman 2011-07-07

    Fixed on Nexus S and Xoom with SDK 1.7.2 r3d44999e and 1.8.0 r4b694252

JSON Source