What action can I do by adding custom action of AlarmKit. How to?

Asked on 06/12/2025

1 search

To add a custom action to an alarm using AlarmKit, you can define a custom button whose action is executed via an app intent. Here's a step-by-step guide on how to do this:

  1. Create a Custom Button: Use the AlarmButton struct to create a custom button. For example, you can create an "Open" button with a white text color and an arrow icon.

  2. Set Button Behavior: Change the secondary button behavior to custom. This allows you to define a custom action for the button.

  3. Define an App Intent: Create an app intent that specifies the action you want to perform when the button is tapped. For instance, you can create an intent to open your app.

  4. Include the Intent in Alarm Configuration: When scheduling the alarm, include the app intent in the alarm configuration. This tells the system to execute the intent when the button is tapped.

  5. Track the Alarm: Use a unique identifier to track the alarm and associate it with the app intent.

For more detailed information, you can refer to the session Wake up to the AlarmKit API (13:42) where these steps are discussed.