투케이2K

195. (kotlin/코틀린) [유틸 파일] setVoiceVolumeUP / setVoiceVolumeDOWN : 통화 볼륨 UP , DOWN 수행 메소드 본문

Kotlin

195. (kotlin/코틀린) [유틸 파일] setVoiceVolumeUP / setVoiceVolumeDOWN : 통화 볼륨 UP , DOWN 수행 메소드

투케이2K 2023. 1. 15. 18:11

[개발 환경 설정]

개발 툴 : AndroidStudio

개발 언어 : Kotlin

 

[소스 코드]

 

        // TODO [SEARCH FAST] : [통화 볼륨 UP]
        fun setVoiceVolumeUP(mContext: Context) {
            try {
                Log.i("---","---")
                Log.d("//===========//","================================================")
                Log.i("","\n"+"[C_KeyVolumeEvt >> setVoiceVolumeUP() :: 통화 볼륨 UP 이벤트 지정]")
                Log.d("//===========//","================================================")
                Log.i("---","---")
                val mAudioManager = mContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager
                mAudioManager.adjustStreamVolume(AudioManager.STREAM_VOICE_CALL, AudioManager.ADJUST_RAISE, AudioManager.FLAG_SHOW_UI)
            } catch (e: Exception) {
                e.printStackTrace()
            }
        }





        // TODO [SEARCH FAST] : [통화 볼륨 DOWN]
        fun setVoiceVolumeDOWN(mContext: Context) {
            try {
                Log.i("---","---")
                Log.d("//===========//","================================================")
                Log.i("","\n"+"[C_KeyVolumeEvt >> setVoiceVolumeDOWN() :: 통화 볼륨 DOWN 이벤트 지정]")
                Log.d("//===========//","================================================")
                Log.i("---","---")
                val mAudioManager = mContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager
                mAudioManager.adjustStreamVolume(AudioManager.STREAM_VOICE_CALL, AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI)
            } catch (e: Exception) {
                e.printStackTrace()
            }
        }

 

반응형
Comments