Skip to content

Instantly share code, notes, and snippets.

@januprasad
Created February 17, 2020 15:16
Show Gist options
  • Save januprasad/0f2995994d997d56170b44e8eec1e6c3 to your computer and use it in GitHub Desktop.
Save januprasad/0f2995994d997d56170b44e8eec1e6c3 to your computer and use it in GitHub Desktop.
private fun startAlarm(calendar: Calendar) {
val alarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager
val intent = Intent(this, AlarmReceiver::class.java)
val pendingIntent = PendingIntent.getBroadcast(this, 0, intent, 0)
alarmManager.setExact(AlarmManager.RTC_WAKEUP, calendar.timeInMillis, pendingIntent)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment