build, fix(app): targetSdk 35 업그레이드 점검 및 Android 15 정확 알람 호환성 보완, Android 15 대응 보완
- 정확 알람 예외 처리 및 백그라운드 서비스 시작 회피 - setAlarmClock 호출부 SecurityException 처리 추가(1회/반복 알람) - 401 응답 시 startService → stopService로 변경해 O+/15 백그라운드 서비스 제약 회피
This commit is contained in:
@@ -35,7 +35,13 @@ class AlarmScheduler(private val context: Context) {
|
||||
}
|
||||
|
||||
val info = AlarmManager.AlarmClockInfo(calendar.timeInMillis, alarmIntent)
|
||||
alarmManager.setAlarmClock(info, alarmIntent)
|
||||
try {
|
||||
// Android 12(S)+: setAlarmClock는 정확 알람 권한 없이도 허용되지만, 보수적으로 예외를 처리한다.
|
||||
alarmManager.setAlarmClock(info, alarmIntent)
|
||||
} catch (_: SecurityException) {
|
||||
// Android 15(targetSdk 35) 호환성: 예외 발생 시 앱이 크래시하지 않도록 방어적으로 무시/로그 처리한다.
|
||||
// 필요 시 설정 화면 유도는 UI 계층(AlarmListActivity 등)에서 수행.
|
||||
}
|
||||
}
|
||||
|
||||
private fun setRepeatingAlarm(alarm: Alarm) {
|
||||
@@ -56,7 +62,11 @@ class AlarmScheduler(private val context: Context) {
|
||||
}
|
||||
|
||||
val info = AlarmManager.AlarmClockInfo(calendar.timeInMillis, alarmIntent)
|
||||
alarmManager.setAlarmClock(info, alarmIntent)
|
||||
try {
|
||||
alarmManager.setAlarmClock(info, alarmIntent)
|
||||
} catch (_: SecurityException) {
|
||||
// Android 15(targetSdk 35) 보완: 예외 발생 시 크래시 방지
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,16 +18,15 @@ class TokenAuthenticator(
|
||||
@UnstableApi
|
||||
override fun authenticate(route: Route?, response: Response): Request? {
|
||||
if (response.code == 401) {
|
||||
context.startService(
|
||||
Intent(context, AudioContentPlayService::class.java).apply {
|
||||
action = AudioContentPlayService.MusicAction.STOP.name
|
||||
}
|
||||
)
|
||||
context.startService(
|
||||
Intent(context, AudioContentPlayerService::class.java).apply {
|
||||
action = "STOP_SERVICE"
|
||||
}
|
||||
)
|
||||
val stopAudioIntent = Intent(context, AudioContentPlayService::class.java).apply {
|
||||
action = AudioContentPlayService.MusicAction.STOP.name
|
||||
}
|
||||
context.stopService(stopAudioIntent)
|
||||
|
||||
val stopPlayerIntent = Intent(context, AudioContentPlayerService::class.java).apply {
|
||||
action = "STOP_SERVICE"
|
||||
}
|
||||
context.stopService(stopPlayerIntent)
|
||||
|
||||
SharedPreferenceManager.clear()
|
||||
val intent = Intent(context, LoginActivity::class.java)
|
||||
|
||||
Reference in New Issue
Block a user