Kotlin AlarmManager y BroadcastReceiver no funcionan

Intento configurar una alarma con AlarmManager, pero mi BroadcastReceiver nunca se llama. Aquí está mi fragment.

val receiver = object : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { //Never gets hit } } context.registerReceiver(receiver, IntentFilter(LOCAL_NOTIFICATION)) val intent = Intent() intent.action = LOCAL_NOTIFICATION val alarmManager = context.getSystemService(ALARM_SERVICE) as? AlarmManager val pendingIntent = PendingIntent.getService(context, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT) val calendar = Calendar.getInstance() calendar.add(Calendar.SECOND, 10) alarmManager?.set(AlarmManager.RTC_WAKEUP, calendar.timeInMillis, pendingIntent) 

Intenté registrar un receptor de transmisión en AndroidManifest.xml, pero parece que nada funciona.

Solutions Collecting From Web of "Kotlin AlarmManager y BroadcastReceiver no funcionan"