Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can store custom data in the contacts database. However "when a user looks at the contacts he or she knows what users they can use my app with," may not be possible if you are thinking users will be able to see the custom data you inserted while using the built-in Android Contacts application. You would have to display the custom data in your own application.</p> <p>The javadocs for the <a href="http://developer.android.com/reference/android/provider/ContactsContract.Data.html" rel="nofollow">ContactsContract.Data</a> class should provide an explanation, as well as the <a href="http://developer.android.com/guide/topics/providers/contacts-provider.html" rel="nofollow">Contacts article</a>.</p> <p>To use this you'll need to get a raw contact id by querying the <a href="http://developer.android.com/reference/android/provider/ContactsContract.RawContacts.html" rel="nofollow">RawContacts</a>.</p> <p>Here some example code that might help you get started...</p> <pre><code>private void makePowerful(int rawContactId) { ContentValues values = new ContentValues(); values.put(Privilege.RAW_CONTACT_ID, rawContactId); values.put(Privilege.MIMETYPE, Privilege.CONTENT_ITEM_TYPE); values.put(Privilege.PRIVILEGE_LEVEL, Privilege.TYPE_POWERFUL); Uri uri = getContentResolver().insert(Data.CONTENT_URI, values); } public static final class Privilege implements ContactsContract.DataColumnsWithJoins, ContactsContract.CommonDataKinds.CommonColumns { public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/my_app_privilege"; public static final int TYPE_POWERFUL = 1; public static final int TYPE_WEAK = 2; public static final String PRIVILEGE_LEVEL = DATA1; private Privilege() { } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload