Dim uri As String
uri = rm.GetDefault(rm.TYPE_RINGTONE)
In this code the uri is : "content://settings/system/ringtone" but for default ringtone i need a uri like this "content://media/internal/audio/media/81"
yes but a need a uri like this for save the current uri ringtone in the sql database for next recall when the ringtone is changed.
if i save this uri "content://settings/system/ringtone" when the ringtone is changed can i set old ringtone with this uri?
ok but maybe i found something..
java code for under api level 18:
B4X:
Uri DefaultRingtoneUri = RingtoneManager.getActualDefaultRingtoneUri(this, RingtoneManager.TYPE_RINGTONE);
if (DefaultRingtoneUri != null) {
Cursor c = getContentResolver().query(DefaultRingtoneUri, null, null, null, null);
c.moveToFirst();
BellName = c.getString(c.getColumnIndex(MediaStore.MediaColumns.TITLE));
mediaURI = String.valueOf(DefaultRingtoneUri);
}
and java code for 4.4 kitkat:
B4X:
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(getApplicationContext(), notification);
r.play();
Dim jo As JavaObject
jo.InitializeStatic("android.media.RingtoneManager")
Dim context As JavaObject = Activity
context = context.RunMethod("getContext", Null)
Log(jo.RunMethod("getActualDefaultRingtoneUri", Array As Object(context, 1)))
Dim jo As JavaObject
jo.InitializeStatic("android.media.RingtoneManager")
Dim context As JavaObject = Activity
context = context.RunMethod("getContext", Null)
Log(jo.RunMethod("getActualDefaultRingtoneUri", Array As Object(context, 1)))