Hey all,

I have this piece of code to enumerate the ringtones on the system:

                RingtoneManager rm = new RingtoneManager(this);
                Cursor c = rm.getCursor();

                c.moveToFirst();
                while(!c.isAfterLast()){

                        Uri geller = rm.getRingtoneUri(c.getPosition());
                        Log.d(TAG,"path: "+geller);
                        Ringtone rt = RingtoneManager.getRingtone(this, geller);
                        Log.d(TAG,"rt: "+rt);

                        Log.d(TAG, "Ringtone: 
"+rm.getRingtone(c.getPosition()));
                        c.moveToNext();
                }
                c.deactivate();

But the RingtoneManager always returns null. Here's some log-output:

01-15 13:48:51.414: DEBUG/CallReceiverActivity(315): path:
content://media/internal/audio/media/1
01-15 13:48:51.503: DEBUG/MediaPlayer(315): Couldn't open file on
client side, trying server side
01-15 13:48:51.613: ERROR/MediaPlayerService(31): Couldn't open fd for
content://media/internal/audio/media/1
01-15 13:48:51.613: ERROR/MediaPlayer(315): Unable to to create media
player
01-15 13:48:51.623: ERROR/RingtoneManager(315): Failed to open
ringtone content://media/internal/audio/media/1
01-15 13:48:51.623: DEBUG/CallReceiverActivity(315): rt: null
01-15 13:48:51.764: DEBUG/MediaPlayer(315): Couldn't open file on
client side, trying server side
01-15 13:48:51.834: ERROR/MediaPlayerService(31): Couldn't open fd for
content://media/internal/audio/media/1
01-15 13:48:51.845: ERROR/MediaPlayer(315): Unable to to create media
player
01-15 13:48:51.845: ERROR/RingtoneManager(315): Failed to open
ringtone content://media/internal/audio/media/1
01-15 13:48:51.845: DEBUG/CallReceiverActivity(315): Ringtone: null

As you can see, the MediaPlayer is unable to open the file. Should I
have extra permissions? Is anything else preventing me from accessing
the file? Would appreciate help :)

Regards,

Daan
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to