I want to make sure AlarmManager is triggered even when my app is manually closed, the same way a messaging app still displayed messages even when closed (swipe or press the "X"). This is my code:

```
class MainActivity : ComponentActivity() {

    private lateinit var alarmManager: AlarmManager

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            val receiver = object : BroadcastReceiver() {
                override fun onReceive(context: Context, intent: Intent) {

                    val mp = MediaPlayer.create(context,R.raw.music)
                    mp.start()

                }
            }

            this.registerReceiver(receiver, IntentFilter("SET_ALARM"))

            alarmManager = getSystemService(ALARM_SERVICE) as AlarmManager

            var calendar = Calendar.getInstance()
            calendar.add(Calendar.MINUTE,1)
            val alarmIntent = Intent()
            alarmIntent.action = "SET_ALARM"
            var pendingIntent = PendingIntent.getBroadcast(this, 0, alarmIntent, 0)

            Column( Modifier
                .fillMaxWidth(),
                horizontalAlignment = Alignment.CenterHorizontally) {

                Button(onClick = { alarmManager.setAndAllowWhileIdle(
                    AlarmManager.RTC_WAKEUP,
                    calendar.timeInMillis,
                    pendingIntent)}) {Text("play song in 1 minute")
                }

            }
        }
}

```

}

It works fine when the app is open, but not when I close manually it . What do I need to add?

(It is not a battery management problem, as it does not work in the emulator either)