get Notification Volume - Android android.media

Android examples for android.media:Volume

Description

get Notification Volume

Demo Code

import android.content.Context;
import android.media.AudioManager;
import android.support.annotation.NonNull;

public class Main{

    /** Return the volume for notifications. */
    public static int getNotificationVolume(@NonNull Context context) {
        return getAudioManager(context).getStreamVolume(
                AudioManager.STREAM_NOTIFICATION);
    }//from w  ww  . j a  v a2 s . c o  m
    private static AudioManager getAudioManager(@NonNull Context context) {
        return (AudioManager) context.getApplicationContext()
                .getSystemService(Context.AUDIO_SERVICE);
    }

}

Related Tutorials