Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15104] Android: Add support for showContactsParams.selectedProperty

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionWon't Fix
Resolution Date2015-01-19T22:04:34.000+0000
Affected Version/sRelease 3.1.2
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, exalture, showcontacts
ReporterFokke Zandbergen
AssigneeHieu Pham
Created2013-09-03T13:51:37.000+0000
Updated2017-03-22T21:33:46.000+0000

Description

The showContactsParams.selectedProperty callback never gets called. Only the showContactsParams.selectedPerson does.

Steps to reproduce:

Run the following app:

    var w = Ti.UI.createWindow({backgroundColor:'white'});
    var b = Ti.UI.createButton({title:'Select'});
    b.addEventListener('click', function () {
      Ti.Contacts.showContacts({
        selectedProperty: function (e) {
          Ti.API.debug('called');
        }
      });
    });
    w.add(b);
    w.open();
    

In the console you won't see called

Replace selectedProperty by selectedPerson and run again

This time you *will* see called

Comments

  1. Thomas Neerup 2014-01-31

    Is there any updates on this one ? The Contacts module is useless on android with this bug:(
  2. Ingo Muschenetz 2014-08-14

    3.4.0 is moved forward, and 3.5.0 is taking its place in the calendar.
  3. Sunila 2014-11-20

    I don't see anyway to get a callback in Android when a contact property is selected.
  4. Jon Alter 2014-11-25

    This is not so much a bug, as it is an unimplemented feature (and a doc bug). Updating the docs to show that selectedProperty is iOS only. PR: https://github.com/appcelerator/titanium_mobile/pull/6401 We should return to this with a little more time to investigate adding this feature.
  5. Ashraf Abu 2014-12-01

    The current implementation for this in Android devices uses the intent to call the Android's contact activity that allows a user to select a contact's Name (a Person). This will actually return all the Person's information available. No other property is shown. Hence there is no "selectedProperty" callback. If you still want a selectedProperty for Android, here's one way:
       var w = Ti.UI.createWindow({backgroundColor:'white'});
       var b = Ti.UI.createButton({title:'Select'});
       
       b.addEventListener('click', function () {
         Ti.Contacts.showContacts({
           selectedPerson: function (e) {
             Ti.API.info('Person:'+e.person.getFullName());    
             	var phoneNumbers = e.person.getPhone();
             	// Handle the various properties. In this example phone numbers can be iterated through
       		for (var phoneType in phoneNumbers) {
       		    Ti.API.info(phoneType+"="+phoneNumbers[phoneType]);
       		}
           }
         });
       });
       w.add(b);
       w.open();
       
    In this example, I iterated through the phone numbers. You can instead open a new window with the Person's selected details and allow a person to select the various properties available.
  6. Hieu Pham 2015-01-08

    When we show all contacts via .showContacts, there are no properties that is displayed on Android. You pick a person and it returns, so 'selectedProperty' is not relevant. On iOS, if you click on a contact, it then show all the available properties for you to select. This isn't the case for Android.
  7. Lee Morris 2017-03-22

    Closing ticket as "Won't Fix".

JSON Source