Question

How to prevent adding same custom ringtone in windows phone? Every time i Click the button, it will save the ringtone in the system ringtone list. But what i found that in the system ringtone list display same ringtone few time. What i wanna to achieve is no matter how many time add, it will only show 1 ringtone only. Its possible to do it?

Any help and suggestion will be appreciate. Thank you.

private void setButton_Click(object sender, RoutedEventArgs e)
{
            try
            {
                saveRingtone = new SaveRingtoneTask();
                saveRingtone.Source = new Uri(@"isostore:/Kalimba.mp3");
                saveRingtone.DisplayName = "Kalimba";
                saveRingtone.IsShareable = true;
                saveRingtone.Completed += new EventHandler<TaskEventArgs>(saveRingtone_Completed);
                saveRingtone.Show();

            }
            catch
            { }
}
Was it helpful?

Solution

You can't enumerate through existing ringtones with the current SDK. This means that there's no way to check if a ringtone already exists with the same name. You could keep track within your app of all the ringtones the user has saved but this may be an issue if the user deletes the ringtone from the phone as your app wouldn't know this has happened.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top