android silent mode programmatically code example
Example: mute the phone kotlin
private fun mutePhone() {
// permission needed
// <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
val audiomanager = getSystemService(Context.AUDIO_SERVICE) as AudioManager
audiomanager.ringerMode = AudioManager.RINGER_MODE_SILENT
}