[TIMOB-15104] Android: Add support for showContactsParams.selectedProperty
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | High |
| Status | Closed |
| Resolution | Won't Fix |
| Resolution Date | 2015-01-19T22:04:34.000+0000 |
| Affected Version/s | Release 3.1.2 |
| Fix Version/s | n/a |
| Components | Android |
| Labels | android, exalture, showcontacts |
| Reporter | Fokke Zandbergen |
| Assignee | Hieu Pham |
| Created | 2013-09-03T13:51:37.000+0000 |
| Updated | 2017-03-22T21:33:46.000+0000 |
Description
The In the console you won't see
Replace
This time you *will* see
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();
Is there any updates on this one ? The Contacts module is useless on android with this bug:(
3.4.0 is moved forward, and 3.5.0 is taking its place in the calendar.
I don't see anyway to get a callback in Android when a contact property is selected.
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.
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:
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.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();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.
Closing ticket as "Won't Fix".