Quantcast
Viewing all articles
Browse latest Browse all 8068

how to get person phonenumber by using select person for android

Hi I am trying to get contact details from android contactbook by using select property but unfortunatly select property is not supporting android. So i used select person now i can get person name and id but i can't get phone number. Please help me am so strugling this part of work. below i added my code:

customNavigation.addEventListener('AddButtonPressed', function(e) {
 
         Titanium.Contacts.showContacts(values); 
 
    });
    self.add(customNavigation);
 
    var values = {cancel:function() {}};
 
 
    if (Ti.Platform.osname === 'android') {
        // android doesn't have the selectedProperty support, so go ahead and force selectedPerson
        values.selectedPerson = function(e) {
 
                var person = e.person;
                var phones = person.phone;
                var found = false;
 
                for(var i = 0; i < contacts.length; i++) {
                                    if (contacts[i].id == person.id) {
                                        found = true;
 
                                        break;
                                    }
                                }
                                if(found == false){
 
                                    contacts.push({title:person.fullName, hasChild:true, id:person.id, color: '#000'});
                                    //contacts.push(row);
 
                                    table.fireEvent('click', {rowData: {title:person.fullName, hasChild:true, recordId:person.id, color: '#000'} });
 
                                }
 
                                table.data = contacts;
                 };
        }
 
 };

Viewing all articles
Browse latest Browse all 8068

Trending Articles