Title | Description |
---|---|
Apple Watch Plugin |
Connect to Apple Watch via Watch Connectivity framework and send/receive messages. |
cordova plugin add https://github.com/thessler27/watch-plugin.git
You must initialize the session for the Apple Watch listener to be activated and to send messages.
AppleWatch.initializeSession():Promise<boolean>
Returns successful promise result with
true
boolean if successful connection, and throws an error with booleanfalse
if unsuccessful.
document.addEventListener('cordovaAppleWatch:didReceiveMessage', handleWatchEventWithData)
When the watch sends a message to the iOS device, it sends the data through this event.
AppleWatch.sendMessage(data):Promise<void>
Send a message with a specific payload. You need to handle this message on the WatchOS device. The promise returns successful if the message was able to be sent. If it was not, it will return an error.
- iOS