Search code examples
androidcontactsandroid-contentproviderandroid-contactsandroid-syncadapter

android contacts provider: how to set phone number primary


How to set a contact's phone number to be primary number when adding or updating a contact building a custom contacts provider. The adding and updating of contacts is working fine but I don't know how to set one number of the contact to be primary, or default number.


Solution

  • mValues.put(Phone.IS_PRIMARY, 1);
    mValues.put(Phone.IS_SUPER_PRIMARY, 1);
    

    Both Phone.IS_PRIMARY and Phone.IS_SUPER_PRIMARY have to be set.