Get name of current ring tone?

All your problems with Audio, Video and Images.

Get name of current ring tone?

Postby boozelclark » Mon Jan 18, 2010 3:49 pm

Hi i'm using the following method to set a ringtone
public void setRingTone(Context context){
try
{
Log.d(LOG_TAG,"setRingTone()");
String filepath ="/sdcard/schoolbell.mp3";
File ringtoneFile = new File(filepath);
Log.d(LOG_TAG,"Starting content puts");
ContentValues content = new ContentValues();
content.put(MediaStore.MediaColumns.DATA,
ringtoneFile.getAbsolutePath());
content.put(MediaStore.MediaColumns.TITLE, "schoolbell");
//content.put(MediaStore.MediaColumns.SIZE, 215454);
content.put(MediaStore.MediaColumns.MIME_TYPE, "audio/mp3");
//content.put(MediaStore.Audio.Media.ARTIST, "Madonna");
//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);
Log.d(LOG_TAG,"Starting database puts");
//Insert it into the database
Log.i(LOG_TAG, "the absolute path of the file
is :"+ringtoneFile.getAbsolutePath());
Uri uri = MediaStore.Audio.Media.getContentUriForPath
(ringtoneFile.getAbsolutePath());
Uri newUri = context.getContentResolver().insert(uri, content);
Uri ringtoneUri = newUri;
Log.i(LOG_TAG,"1 the ringtone uri is :"+uri);
Log.i(LOG_TAG,"2 the ringtone uri is :"+ringtoneUri);
RingtoneManager.setActualDefaultRingtoneUri
(context,RingtoneManager.TYPE_RINGTONE,newUri);
}
catch (Exception e)
{Log.e(LOG_TAG,"Error @3:"+e.getMessage());}
}
It works perfectly except i only want it to add the tone if it hasent
been added already, is there any way to get the name of the current
ringtone so i can compare it to the file i want to set as my ring
tone? or another way of doing it?
Any help would be great. Thank you
boozelclark
Freshman
Freshman
 
Posts: 3
Joined: Mon Jan 11, 2010 3:14 pm

Top

Postby ramprasath » Mon Feb 01, 2010 7:22 am

can any one tell me how to set custom ringtone for each contact?
ramprasath
Freshman
Freshman
 
Posts: 4
Joined: Mon Jan 25, 2010 7:38 am
Location: chennai

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 9 guests