Activity appears in idle mode

I have a question concerning Android Studio. In the alarm of an android device, when I set up an alarm at a time, the alarm rings and the activity appears on the screen at this time, even when the screen is locked.
I would like to know how it is possible to do that because I am building my own alarm and I would like to know which codes allows this functionality to make the activity appears when the device is locked (in sleep mode).

Thank you in advance for your help 🙂