Set the ringtone for a contact programmatically

Is it possible in the SDK to set the ringtone for a contact without using the ContactUI?


Thanks

You can use ContactsContract.Contacts which has a column CUSTOM_RINGTONE (which is a read/write column!) for this purpose.

Uri contactUri;

ContentValues values = new ContentValues(); values.put(ContactsContract.Contacts.CUSTOM_RINGTONE, newRingtoneUri.toString()); context.getContentResolver().update(contactUri, values, where, args);

Set the ringtone for a contact programmatically
 
 
Q