Reputation: 561
I'm working in WatchKit 2.0. I want to customize my watch app's context menu based on state information in the corresponding iOS app. For example, if a process is running in the iOS app I want my context menu to have a "stop" menu item, and if the app is idle then I want the context menu to have "start new" and "continue previous" menu items.
From the watch side, is there a way to detect when the context menu is about to appear so I can poll the app to get state information and customize the menu items accordingly?
Failing that, what is the preferred approach? I suppose I could have the iOS app push state information to the watch whenever states change, but that would obviously fail if the watch wasn't on or in range.
Upvotes: 0
Views: 335
Reputation: 561
Now that I've read more about the WatchConnectivity framework, I think the preferred approach is to use the updateApplicationContext(_:)
function in the WCSession
class to signal state changes. The watch will receive the state change at its earliest opportunity. That seems to be working reasonably well, at least in the simulator.
Upvotes: 1