how do you insert a ringtone 
> programmatically? 
>
>
Hi Skink, I used the following code for inserting/setting the ringtone.

 String filepath ="/sdcard/my music/Dard-E-Tanhai.mp3";
        File ringtoneFile = new File(filepath);
        ContentValues content = new ContentValues();
        
content.put(MediaStore.MediaColumns.DATA,ringtoneFile.getAbsolutePath());
        content.put(MediaStore.MediaColumns.TITLE, "test");
        content.put(MediaStore.MediaColumns.SIZE, 215454);
        content.put(MediaStore.MediaColumns.MIME_TYPE, "audio/*");
        content.put(MediaStore.Audio.Media.ARTIST, "artist");
        content.put(MediaStore.Audio.Media.DURATION, 230);
        content.put(MediaStore.Audio.Media.IS_RINGTONE, true);
        content.put(MediaStore.Audio.Media.IS_NOTIFICATION, false);
        content.put(MediaStore.Audio.Media.IS_ALARM, false);
        content.put(MediaStore.Audio.Media.IS_MUSIC, false);

        Uri uri = MediaStore.Audio.Media.getContentUriForPath(
        ringtoneFile.getAbsolutePath());
        Uri newUri = 
getApplicationContext().getContentResolver().insert(uri, content);

        RingtoneManager.setActualDefaultRingtoneUri(getApplicationContext(),
        RingtoneManager.TYPE_RINGTONE,newUri); 

I hope, this will help you out to get what I have done yet.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to