How can I get phone number in android?
Sample Code:
var contacts = Titanium.Contacts.getAllPeople();
Titanium.API.log(contacts[0].phone['mobile'][0]); //in iOS, returns "01012345678" fine :)
Titanium.API.log(contacts[0].phone['mobile'][0]); //in Android, returns "" :(
Titanium.API.log(contacts[0].fullName); //in Android & iOS, returns "test Name" fine :)
Titanium.API.log(contacts[0].phone); //in Android, returns "" :(
This code worked for me. It scans all the contact numbers from the phone book whether it is mobile or home or anything else. Code also removes all non-digit characters from the number too:
Try the following code, It worked with me
note that your phone should have contact number in mobile and home options. I've added a screen shot from my android emulator. Just try giving numbers like this