Initialize the AudioManager in AlarmService

Gradual volume increase was not working because of this.
This commit is contained in:
Naveen Singh
2025-04-13 18:25:03 +05:30
parent 3dbc151c5c
commit e83db9db38

View File

@@ -59,6 +59,11 @@ class AlarmService : Service() {
private val autoDismissHandler = Handler(Looper.getMainLooper())
private val increaseVolumeHandler = Handler(Looper.getMainLooper())
override fun onCreate() {
super.onCreate()
audioManager = getSystemService(AUDIO_SERVICE) as AudioManager
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
val alarmId = intent?.getIntExtra(ALARM_ID, -1) ?: -1
alarm = if (alarmId != -1) {