You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Quinn 8f30c5b0d9 update files 8 months ago
.idea/codeStyles Added option to show and hide system volume UI while updating volume 2 years ago
android add isPlaying 8 months ago
example update files 8 months ago
ios changes 2 years ago
lib add isPlaying 8 months ago
.gitignore Merge branch 'master' of 2 years ago
.metadata changes 2 years ago Removed unused import issues 1 year ago
LICENSE changes 2 years ago Doc Readme update 2 years ago
pubspec.yaml Removed unused import issues 1 year ago
volume.iml Merge branch 'master' of 2 years ago


Controll Volume in Android programatically. No IOS Implementation yet . Pull Request for ios implementation are welcome.


AudioManager.STREAM_VOICE_CALL       -> Controll IN CALL Volume
AudioManager.STREAM_SYSTEM           -> Controll SYSTEM Volume
AudioManager.STREAM_RING             -> Controll RINGER Volume
AudioManager.STREAM_MUSIC            -> Controll MEDIA Volume
AudioManager.STREAM_ALARM            -> Controll ALARM Volume
AudioManager.STREAM_NOTIFICATION     -> Controll NOTIFICATION Volume

Show and Hide System UI

ShowVolumeUI.SHOW (DEFAULT)          -> Show system volume UI while changing volume 
ShowVolumeUI.HIDE                    -> Do not show system volume UI while changing volume 

Functions and getters

Volume Buttons will affect this volume when in app

await Volume.controlVolume(AudioManager audioManager); // pass any stream as parameter

Returns maximum possible volume in integers

await Volume.getMaxVol; // returns an integer

Returns current volume level in integers

await Volume.getVol;// returns an integer

Set volume for the stream passed to controlVolume() function

await Volume.setVol(int i, {ShowVolumeUI showVolumeUI});

Max value of i is less than or equal to Volume.getMaxVol.

showVolumeUI is optional parameter which defaults to ShowVolumeUI.SHOW.


class _MyAppState extends State<MyApp> {
  int maxVol, currentVol;

  void initState() {
    audioManager = AudioManager.STREAM_SYSTEM;

  Future<void> initAudioStreamType() async {
    await Volume.controlVolume(AudioManager.STREAM_SYSTEM);

  updateVolumes() async {
    // get Max Volume
    maxVol = await Volume.getMaxVol;
    // get Current Volume
    currentVol = await Volume.getVol;
    setState(() {});

  setVol(int i) async {
    await Volume.setVol(i, showVolumeUI: ShowVolumeUI.SHOW);
    // or 
    // await Volume.setVol(i, showVolumeUI: ShowVolumeUI.HIDE);
  // To implement the volume Up and volume Down button press programatically.