IT/Android
Kotlin] 안드로이드 알람 설정 & 해제
깻잎쌈
2020. 3. 29. 23:40
반응형
알람설정
val intent = Intent(AlarmClock.ACTION_SET_ALARM)
intent.putExtra(AlarmClock.EXTRA_HOUR, myHour) // 시간 설정
intent.putExtra(AlarmClock.EXTRA_MINUTES, myMinute) // 분 설정
intent.putExtra(AlarmClock.EXTRA_MESSAGE, "아알람") // 메세지 설정
intent.putExtra(AlarmClock.EXTRA_SKIP_UI, true) // ui없이 바로 알람 저장
startActivity(intent)
알람 해제
val intent = Intent(AlarmClock.ACTION_DISMISS_ALARM)
intent.putExtra(AlarmClock.EXTRA_HOUR, deadline[0].toInt())
intent.putExtra(AlarmClock.EXTRA_HOUR, deadline[1].toInt())
intent.putExtra(AlarmClock.EXTRA_SKIP_UI,true)
startActivity(intent)
반응형