How can I programmatically get the contact list of Android/iPhone using titanium
, I need this for read only purpose.
I already checked this Can I get a user's phone number using any of the Titanium API's?, but I like to open it using my app and then dial a call to the selected number, my app will not perform any other action(edit, delete) on the number. Is that possible in Android and iPhone using titanium or simple Android and iPhone?
First you need to gain access to contacts as described here.
After that it is possible to get all contacts via getAllPeople
This works for both iOS and Android.
Performing a call works simple on Android (you should create a Phone Call Intent with Ti.Android.ACTION_DIAL
). On iOS you simply need display the number and the system should link it to a call action. If not you can add a listener to the element:
label.addEventListener('click', function(e) {
Ti.Platform.openURL('tel:<number');
});