1

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

Genaut
  • 1,810
  • 2
  • 29
  • 60
  • refer this [link][1] for set ringtone [1]: http://stackoverflow.com/questions/1986756/setting-ringtone-in-android – iAndroid Aug 02 '12 at 21:42
  • I try with these code but I only can add the sound name to the ringtone library, It isn't select by default and if I select it, not sound.. :( – Genaut Aug 02 '12 at 22:41

0 Answers0