Skip to content

Instantly share code, notes, and snippets.

@garg-lucifer
Last active September 24, 2022 08:56
Embed
What would you like to do?
private fun removeAlarm(taskInfo: TaskInfo){
val alarmManager = activity?.getSystemService(Context.ALARM_SERVICE) as AlarmManager
val intent = Intent(requireContext(), AlarmReceiver::class.java)
// It is not necessary to add putExtra
intent.putExtra("task_info", taskInfo)
val pendingIntent = PendingIntent.getBroadcast(requireContext(), taskInfo.id, intent, PendingIntent.FLAG_IMMUTABLE)
alarmManager.cancel(pendingIntent)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment