title: How to save my own unique identifier when I add a contact to android programatically
body: <p>When saving a contact to the Android contacts database, I would like to save my own unique identifier to the contact. How can this be achieved?</p>
  
  <p>Here is my attempt so far,</p>
  
  <pre><code>    private void saveMyId(int myId, ArrayList&lt;ContentProviderOperation&gt; ops){
          ops.add(ContentProviderOperation.
                          newInsert(ContactsContract.Data.CONTENT_URI)
                          .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0)
                          .withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
                          .withValue("MyId", myId).build()
          );
      }
  </code></pre>
  
  <p>This crashes with the following error</p>
  
  <blockquote>
    <p>android.content.OperationApplicationException: insert failed at
    android.database.DatabaseUtils.readExceptionWithOperationApplicationExceptionFromParcel(DatabaseUtils.java:158)</p>
  </blockquote>