Skip to content

Commit

Permalink
feat: use correct alarm volume settings
Browse files Browse the repository at this point in the history
  • Loading branch information
SuhasDissa committed Oct 31, 2023
1 parent 780c6c4 commit aca5911
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions app/src/main/java/com/bnyro/clock/services/AlarmService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import android.app.Service
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.media.AudioAttributes
import android.media.AudioManager
import android.media.MediaPlayer
import android.media.RingtoneManager
import android.net.Uri
Expand Down Expand Up @@ -93,6 +95,13 @@ class AlarmService : Service() {

private fun startAlarm(player: MediaPlayer) {
player.isLooping = true
player.setAudioAttributes(
AudioAttributes
.Builder()
.setUsage(AudioAttributes.USAGE_ALARM)
.setLegacyStreamType(AudioManager.STREAM_ALARM)
.build()
)
player.prepare()
player.start()
}
Expand Down

0 comments on commit aca5911

Please sign in to comment.