Trigger When an App Is Opened or Closed
Learn how to create a Shortcut automation on your iPhone that triggers actions when an app is opened or closed. This step-by-step guide uses TikTok as an example, showing you how to automatically adjust the device volume when the app is launched. The tutorial covers setting up an automation in the Shortcuts app, choosing an app as the trigger, configuring settings, and adding actions like setting the volume. You can also customise automations for when an app is closed and get creative with other actions like enabling Do Not Disturb.
·
Oct 12, 2024
In this quick tutorial, we'll walk you through creating an automation in the Shortcuts app to trigger actions when a specific app is opened or closed. For this example, we’ll use the TikTok app and show how to reduce the device volume when the app is opened.
Let’s get started!
1. Open the Shortcuts App and Create a New Automation
First, open the Shortcuts app on your iPhone and navigate to the Automation tab.
In the top right corner, tap the + icon to create a new automation.
2. Choose the App as Your Trigger
Scroll down the list of available triggers until you see the option for App. You’ll see a prompt that says something like, “When ‘Weather’ is opened or closed.” Tap this.
Now, tap Choose and select the app you want to use as the trigger—in this case, TikTok. After selecting your app, decide whether you want the automation to trigger when the app is Opened or Closed.
3. Configure Important Settings
Here’s a key step: make sure to toggle Run Immediately. If you don’t, you’ll be prompted to manually run the automation every time, which defeats the purpose!
You can also decide whether you want to receive a notification when the automation runs. For something simple like adjusting the volume, you probably don’t need a notification, so feel free to turn this off.
Once that’s set, tap Next in the top right corner.
4. Choose or Create a New Automation
At this stage, you’ll have the option to either select a pre-existing shortcut or create a new one. For this tutorial, we’ll choose New Blank Automation.

5. Add an Action to Set Device Volume
Now it’s time to define what happens when the app is opened. Tap Add Action and search for Set Volume.
Once you’ve found it, add this action to your shortcut. You can then adjust the device volume to your desired level (perhaps turning it down if you’re opening TikTok, for example).
When you’ve set the volume to your liking, tap Done.
6. Test Your Automation
And that’s it! Now, when you open TikTok, the volume should automatically adjust to the level you set. You’ll see the volume slider pop up briefly, confirming the change.

Bonus Tip: Trigger Actions When an App Is Closed
If you'd prefer to increase the volume (or trigger a different action) when TikTok is closed, just repeat the steps above, but in step 4, select Is Closed instead of Is Opened.
Get Creative with Your Automations!
While this tutorial focused on adjusting volume, the possibilities are endless. For instance, I have a similar automation for when I launch YouTube: it enables Do Not Disturb (DND) when the app is opened and disables DND when I close it.
If you're interested in more advanced automations like this, let me know in the comments, and I'd be happy to cover them!
Comments