IOS & WatchOS background communication

472 Views Asked by At

I have a IOS application with a companion WatchOS application. I am wondering if there is a way I can communicate with the IOS application in real time while it not running as a foreground application.

The best example I can think of is how your are able to use the Spotify watch app to change songs, like songs or even change the volume of the phone while the phone is locked.

How could I implement something like this for an application that could possibly send data frequently from the watch to the phone while the phone is locked.

2

There are 2 best solutions below

5
Shadowrun On

Watch apps can launch their companion iOS apps by messaging them:. https://developer.apple.com/documentation/watchconnectivity/wcsession/1615687-sendmessage

That won’t work if the iOS device requires unlock because it’s just booted up.

0
Eric Dolecki On

I just started WatchOS development and needed to send a message to the watch app - if it's available I use sendMessage. If the watch app is backgrounded, I use transferUserInfo. Link to code snippets. I check isReachable and isPaired (on the phone, isPaired does not exist in WatchOS).