Apparatus standard notification ringtone

Asked

Viewed 259 times

1

In my application I have in the settings an option for the user to select the sound that will run when receiving notification.

inserir a descrição da imagem aqui

Then I open one AlertDialog and list the standard ringtone of the device itself:

Uri defaultRingtoneUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone defaultRingtone = RingtoneManager.getRingtone(context, defaultRingtoneUri);

I get the title and location with:

//Titulo
defaultRingtone.getTitle(context)
// Path
defaultRingtoneUri.getPath()

And the other notifications thus obtained:

RingtoneManager manager = new RingtoneManager(context);
manager.setType(RingtoneManager.TYPE_NOTIFICATION);

Cursor cursor = manager.getCursor();

The title and location, after doing the loop, get with:

// Título
cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX)
// Path
cursor.getString(RingtoneManager.URI_COLUMN_INDEX) + "/" + cursor.getString(RingtoneManager.ID_COLUMN_INDEX)

Problem

What happens is that the first name of the notification (which I get by the first code), on my device the title shows Standard ringtone (Tejat), which is true, but when I go to play the sound is a different one and not the Tejat.

And when I play Tejat obtained by RigntoneManager, is the right sound.

Standard ringtone (Tejat): /system/notification_sound
Tejat: content://media/Internal/audio/media/7

Question

What happens so the default ringtone isn’t really right? How to resolve this?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.