安卓5.1系统音量无法调节,一直都是最大声。

dong 2021-5-31 1032

音量大小无法调节,调用的是语音通话类型? 以下是设置音量的代码,帮忙分析下是哪里有问题,谢谢。

  • int callMaxVolume;
  • AudioManager audioaManager = (AudioManager) MyApp.getContext().getSystemService(Context.AUDIO_SERVICE);
  • audioaManager .setMode(AudioManager.MODE_IN_CALL);
  • callMaxVolume = audioaManager .getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL);//最大值为5
  • int volume = audioaManager .getStreamVolume(AudioManager.STREAM_VOICE_CALL);
  • volume++;
  • if (volume >= callMaxVolume) {
  • volume = callMaxVolume;
  • }
  • Log.i(TAG, "当前音量 " + volume +" 最大音量 " + callMaxVolume);
  • audioaManager .setStreamVolume(AudioManager.STREAM_VOICE_CALL, volume, 0);
最新回复 (1)
  • HeavyRain 2021-6-1
    引用 2
    这个我们也没有这方面的经验,5.1的系统已经太旧了吧,如果都是用的系统的方法,会不会系统的问题
返回