1
我正在創建一個簡單的鬧鐘應用程序,用於測試用戶是否不隨設備一起移動。如果有,服務將播放警報聲。Android:設置最大音量
問題是,如果用戶將音量設置爲某些較低值(或將其靜音)。即使我使用下一個代碼,我的應用程序也會使用此音量設置。
player = MediaPlayer.create(this, R.raw.sound);
audioManager = (AudioManager)getSystemService(AUDIO_SERVICE);
userVolume = this.audioManager.getStreamVolume(AudioManager.STREAM_ALARM);
audioManager.setStreamVolume(AudioManager.STREAM_ALARM, this.audioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM), AudioManager.FLAG_PLAY_SOUND);
有沒有辦法設置「主」卷?
它不會影響在所有的音量... – Lorin