PendingIntent and Alarms Issue

Report a typo

John has created a one-time alarm to fire the PendingIntent. However, the intent is not launching! Help him figure out the cause of the problem.

val intent = Intent(applicationContext, Receiver::class.java)
val pendingIntent = PendingIntent.getBroadcast(this, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT)
val chosenTime = calendar.timeInMillis

val alarmManager: AlarmManager = getSystemService(ALARM_SERVICE) as AlarmManager
alarmManager.set(AlarmManager.RTC_WAKEUP, chosenTime, pendingIntent)
Select one or more options from the list
___

Create a free account to access the full topic