Hello,

i have Code which plays a notification sound using the MediaPlayer :

AssetFileDescriptor afd = null;
try
{
        afd = getContext().getResources().openRawResourceFd(_resourceID);
        player.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(),
afd.getLength());
        player.setVolume(VOLUME, VOLUME);
        player.prepare();
        player.start();
...
...


How can i respekt the Volume Settings of the User ? VOLUME is set to
1.0f there.

I thought it would possible to read the Volume using the AudioManager,
but it will return an integer:

final AudioManager audioManager = (AudioManager)
_context.getSystemService(Context.AUDIO_SERVICE);
final int volume =
audioManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION);


Thx,
Jens


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

Reply via email to