I wanna set a mp3
from my raw
folder to ringtone, notification and alarm
, I have a switch and this sentences:
public void onClick(DialogInterface dialog, int item) {
Uri path = Uri.parse("android.resource://com.genaut.instantbuttonsfreak/raw/"+sonidoActual);
switch(item){
case 0:
RingtoneManager.setActualDefaultRingtoneUri(getApplicationContext(), RingtoneManager.TYPE_RINGTONE, path);
//RingtoneManager.getRingtone(getApplicationContext(), path).play();
Log.d("RutaTONO", RingtoneManager.getActualDefaultRingtoneUri(getApplicationContext(), RingtoneManager.TYPE_RINGTONE).toString());
break;
case 1:
RingtoneManager.setActualDefaultRingtoneUri(getApplicationContext(), RingtoneManager.TYPE_NOTIFICATION, path);
break;
case 2:
RingtoneManager.setActualDefaultRingtoneUri(getApplicationContext(), RingtoneManager.TYPE_ALARM, path);
break;
}
}
Well, on case 0
, The first line set the sound to default call ringtone, the second line play the sound and the third shows a log with the uri, all this works fine, or I think it.
The problem is that the sound dont play when my phone is called, notified or "alarmed". Sorry my bad english.
I have this uses-permissions
:
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Always I change this, the soud is my mobile default sound :S