Search code examples
ioswatchkitapple-watch

how to programatically trigger notification on the watch from my iOS app


So this feels like it should be a common question here on StackOverflow and Apple's dev forums, but all the question/answers I have found date from long before 2024. The TLDR version of this question is: How to get my iOS app to trigger a notification that appears ONLY on the watch.

While a regular vanilla local notification might appear on either the phone or the watch (depending on each devices locked state), my use case needs to always alert the watch (as this particular app is used by deaf folks that may not be presently looking at their unlocked phone)

I'd be thrilled if this were as easy as simply setting up some UNNotification on the iOS app where I can target it to get displayed on any watch the phone is paired with.

According to this older answer, I might be able to do what I need via a WatchKit Extension. Anyone have any pointers to the modern solution?


Solution

  • There is no way to direct a notification to the watch from your iOS app. As you say in your question, iOS will decide whether to route a notification to the watch based on whether they think the user is currently looking at their phone, whether it is locked and so on.

    The only way to force the notification to be shown on the watch is for you to add a watch app to your iOS app. Then your iOS app can send a message to your watch app via WCSession and the watch app can post a local notification. Notifications generated by watch apps are always shown only on the watch.