In my program, I want to save the selected ringtone by its path to the file, and then set it as the current ringtone later.
I have a uri ringtone from RingtonePreference and get the path to it from the MediaStore database.
eg.
Uri - content: // media / internal / audio / media / 29
Path - /system/media/audio/notifications/Ascend.mp3
Now, how do I get the Uri ringtone from the file path that I saved?
Since the ringtone already exists in MediaStore, I tried the following functions, but it does not work.
uriRingtone = MediaStore.Audio.Media.getContentUriForPath (szRingtonePath);
Uri is not the same as what I got from RingtonePreference.
uriRingtone - content: // media / internal / audio / media
How do I request MediaStore to get the Uri I need?
ps the reason why I donβt store the Uri ringtone directly is because I found that the Uri for the same ringtone can sometimes change on some device.
source share