Try to remove the ringtone from MediaStore.Audio.Media
Uri uri = MediaStore.Audio.Media.getContentUriForPath(ringtone_path); int roweffected = getContentResolver().delete(uri, MediaStore.MediaColumns.DATA + "=\"" + ringtone_path + "\"", null); if(roweffected>0){ //ringtone deleted } else{ //ringtone not deleted }
EDIT: you can also remove RINGTONE from the list as:
ContentValues cv = new ContentValues(); Uri uri = MediaStore.Audio.Media.getContentUriForPath(ringtone_path); cv.put(MediaStore.Audio.Media.IS_RINGTONE, false); cv.put(MediaStore.Audio.Media.IS_NOTIFICATION, false); cv.put(MediaStore.Audio.Media.IS_ALARM, false); cv.put(MediaStore.Audio.Media.IS_MUSIC, true); int rowupdate = getContentResolver().update(uri, cv, MediaStore.MediaColumns.DATA + "=?",new String[] {ringtone_path}); if(rowupdate>0){ //ringtone update } else{ //ringtone not update }
source share