//Get phone volume if running or android or application volume if running on pc //(or wanted by user) public float GetVolume() { if (m_bGetVolumeFromPhone && CommonAndroid.IsRunningOnAndroid()) { AndroidJavaObject audioManager = CommonAndroid.GetAndroidAudioManager(); return(audioManager.Call <int>("getStreamVolume", 3)); } else { return(AudioListener.volume); } }
//set phone or application volume (according if running on android or if user want application volume) public void SetVolume(float a_fVolume) { if (m_bGetVolumeFromPhone && CommonAndroid.IsRunningOnAndroid()) { AndroidJavaObject audioManager = CommonAndroid.GetAndroidAudioManager(); audioManager.Call("setStreamVolume", 3, (int)a_fVolume, 0); } else { AudioListener.volume = a_fVolume; } }