Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Docs for Contacts API?

I'm trying to use the Contacts API.
However, unfortunately, this is currently neither in the Docs or in the Kitchensink example.
The best docs I could find are at
While I get a contact picker working, with Titanium.Contacts.showContactPicker from the return info I can get the name, but not the Phonenumber:
doesn't work.
Anybody got an working example, or better docs?

— asked April 26th 2010 by Martijn Pannevis
  • android
  • api
  • contacts
  • docs
  • iphone
  • mobile
1 Comment
  • I need better support for the AB on both iPHONE and ANDROID… kind of urgent as I already committed to do a project using it. But I dont think the AB is ready… So I wanted to ask the Ti-iPHONE staff if this would be a sensible idea… I was thinking of doing an AB extension in xCODE… Am I biting off more than I can chew here? I do know ObjC, and the AB api, but if this issue is already resolved, but I just need to find the docs, I would prefer to not re-invent the wheel. can I get some more advice on what to do here?

    — commented July 10th 2010 by vincent youmans

8 Answers

  • You need to consider this Q&A entry when handling Android contacts: http://developer.appcelerator.com/question/126472/android-how-to-get-email-from-person-in-contacts

    You should also check the current Titanium.Contacts API docs as pretty much all properties of returned contacts are accounted for.

    Finally, Android cannot add/edit contacts via the core Titanium.Contacts API, but you can do it by using Android Intents. Check out the "Forging Titanium Episode 9: Android Intent Cookbook" screencast to see exactly how to do this.

    — answered October 5th 2011 by Tony Lukasavage
  • Martijn,

    Did you get this figured out? I'm trying to do something similar. I want to only pick a user with a phone number. If I set the details parameter to


    I get a contact record with first name, last name and nothing else.

    — answered May 17th 2010 by Curtis Olson
  • It took quite some figuring out, but I now use Titanium.API.info('Phonenr:'+event.contact.phone[0].value);
    for the phonenumber. That (mostly) works, altho not on all numbers.
    However, the iPhone also includes a picker that allows the user (in the modal) to not only select a person, but only a number. I really hope there is a way to call this from Titanium too, but I haven't figured it out yet…
    Let me know if you do!

    — answered May 17th 2010 by Martijn Pannevis
  • To make things clearer: The variable for phonenumber is phone. Not phonenumber.
    Thanks for the details example, helped me a lot!

    — answered May 17th 2010 by Martijn Pannevis
  • Hi there,

    contact.phone[0].value works for phone numbers on iPhone and simulator, but contact.email[0].value crashes my app on iPhone. It works as expected on simulator. Any tips?

    — answered May 21st 2010 by Hans Johansson
  • Nope, and I'm also having some issues with crashing:

    I have 2 issues. The main issue is that if a contact has multiple contacts, and I select the not-first phonenumber, the app crashes on reading the number. No error messages, it just crashes.
    The second is that it also crashes on reading the organisation.
    My (simplified) code:
    var phonenr=event.contact.phone[0].value; //This crashes if I pick the not-first phone number for the contact.
    var org=event.contact.organization; //This always crashes
    Any insight is welcome!

    — answered May 21st 2010 by Martijn Pannevis
  • I wanted to get a status on the issues above. I have a project where I need to get at the NATIVE Address book, and I would really like to hear some success stories as well as how you did it. perhaps some sample code. And some gotchas…

    — answered July 8th 2010 by vincent youmans
  • An update: I did use (and ship) a project (on iPhone) using Contacts. As the details were too buggy (crashed when a contact had more than 1 phonenumber) I implemented this myself.

    — answered July 8th 2010 by Martijn Pannevis
    • The contacts API has recently had a really decent overhall in Ti. Would be good to check it out again and see if the issues you were experiencing before are still around.

      — commented July 8th 2010 by David Ashwood
    • hey dave… I have been following the AB thing for a while, and all the docs I can find are:
      is there more docs than this? I get the sense that the AB is not at all ready for prime time, but its such a vital API.. are there no samples out there to check out?

      — commented July 10th 2010 by vincent youmans
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.