Volume Control in android application

后端 未结 4 1821
既然无缘
既然无缘 2020-11-27 02:29

I\'d like to know how to control my application\'s volume from the volume keys (contrary to my belief , I\'ve read they control only the ringer volume). Should I overwrite t

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 03:19

    In your activity you can use one of the following:

    this.setVolumeControlStream(AudioManager.STREAM_MUSIC);
    this.setVolumeControlStream(AudioManager.STREAM_RING);  
    this.setVolumeControlStream(AudioManager.STREAM_ALARM);  
    this.setVolumeControlStream(AudioManager.STREAM_NOTIFICATION);  
    this.setVolumeControlStream(AudioManager.STREAM_SYSTEM);  
    this.setVolumeControlStream(AudioManager.STREAM_VOICECALL);  
    

提交回复
热议问题