Notice
Recent Posts
Recent Comments
Link
투케이2K
396. (kotlin/코틀린) [Android 13] 안드로이드 AudioManager 사용해 통화 볼륨 UP , DOWN 수행 - STREAM_VOICE_CALL 본문
Kotlin
396. (kotlin/코틀린) [Android 13] 안드로이드 AudioManager 사용해 통화 볼륨 UP , DOWN 수행 - STREAM_VOICE_CALL
투케이2K 2023. 8. 23. 20:56[개발 환경 설정]
개발 툴 : AndroidStudio
개발 언어 : Kotlin
[소스 코드]
// ----------------------------------------------------------------------------------
// TODO [SEARCH FAST] : [통화 볼륨 UP]
// ----------------------------------------------------------------------------------
fun setVoiceVolumeUP(mContext: Context) {
try {
// ===============================================================
S_Log._D_("통화 볼륨 UP 이벤트 지정", null)
// ===============================================================
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 {
// ===============================================================
S_Log._D_("통화 볼륨 DOWN 이벤트 지정", null)
// ===============================================================
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()
}
}
반응형
'Kotlin' 카테고리의 다른 글
Comments