Files
radiola-android/app/src/main/java/com/radiola/service/AlarmReceiver.kt
nk 861b0e2b8f feat: будильник с радиостанцией + выбор битрейта по умолчанию
Будильник (Settings → Будильник): несколько будильников, время, станция, дни недели,
fade-in пробуждения. AlarmManager.setAlarmClock (вне doze) + фолбэк, BootReceiver
перепланирует после перезагрузки, AlarmReceiver→PlayerService (foreground) →
PlayerController.startAlarmPlayback (нарастание громкости). Room: AlarmEntity/Dao, БД v7.
Выбор битрейта по умолчанию в Settings (Авто/Эконом/Стандарт/Высокое) → preferredBitrate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 15:25:42 +03:00

24 lines
824 B
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.radiola.service
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import androidx.core.content.ContextCompat
/**
* BroadcastReceiver-триггер будильника.
* Не Hilt-инжектируемый — намеренно простой: только передаёт id в PlayerService.
*/
class AlarmReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val alarmId = intent.getIntExtra("alarm_id", -1)
if (alarmId < 0) return
val serviceIntent = Intent(context, PlayerService::class.java).apply {
action = PlayerService.ACTION_ALARM
putExtra("alarm_id", alarmId)
}
ContextCompat.startForegroundService(context, serviceIntent)
}
}