I would like to add a custom ringtone in a rawcontact (before create the contact).
I used this code with succes to add a custom ringtone in a contact (already created):
String select = ContactsContract.Contacts._ID + "=?";
String[] args = new String[]{getAndroidId()};
changesToCommit.add(ContentProviderOperation.newUpdate(ContactsContract.Contacts.CONTENT_URI)
.withSelection(select, args)
.withValue(ContactsContract.Contacts.CUSTOM_RINGTONE, ringtone_uri_string)
.build());
So now, i try to insert a custom ringtone in a rawcontact (a new contact not already created). I've tried with this code:
changesToCommit.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI)
.withValueBackReference(ContactsContract.RawContacts._ID, 0)
.withValue(ContactsContract.RawContacts.CUSTOM_RINGTONE, ringtone_uri_string)
.build());
But it doesn't work. Any ideas ?