Reputation: 11994
Is it possible to vibrate watch while Watch Extension is running? We can do it on iOS in this way (force iPhone to vibrate):
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
I hope there is something similar on WatchKit.
Update: I have added issue to Apple radar and recieved the answer:
Engineering has determined that your bug report (20019274) is a duplicate of another issue (19025053) and will be closed.
19025053 is still open.
Update 2: AudioServicesPlayAlertSound()
not working on watch simulator with any sound ID. Seems like function is not supported.
Upvotes: 24
Views: 7715
Reputation: 1817
You can now ask the Watch to vibrate if you target watchOS 2.0
To do this all you need to do is call playHaptic
on a WKInterfaceDevice
instance with any WKHapticType
. In the example below it will play the notification haptic.
Swift 3
WKInterfaceDevice.current().play(.notification)
Objective-C
[[WKInterfaceDevice currentDevice] playHaptic:WKHapticTypeNotification];
You can further read the Apple WKInterfaceDevice Documentation
Upvotes: 39
Reputation: 1738
This is the answer in objective-c after watchOS 2
[[WKInterfaceDevice currentDevice] playHaptic:WKHapticTypeNotification];
Upvotes: 2
Reputation: 1
With WatchKit, you have to remember that your code runs on the iPhone and not on the watch. Therefore, AudioServicesPlaySystemSound call from a WatchKit extension would run on the iPhone, not on the watch. It will make the iPhone vibrate.
Upvotes: -3