Reputation: 269
I have a question in preparation for a potential iWatch app. Having no prior experience writing iOS apps, the API feels pretty daunting and difficult to navigate.
A central part of this project includes sending bursts of vibrations to an iWatch - is this at all possible or am I restricted to standard 'notification' vibrations? And if so, is it known at which rate one may send notifications with vibrations?
I found a possible related topic here on StackO: Are there APIs for custom vibrations in iOS? Is this approach applicable for iWatch apps?
Thank you in advance.
Upvotes: 9
Views: 5305
Reputation: 9426
Currently, there is no API for custom haptic feedback. But as of watchOS 2.0 you can invoke haptic feedback by supplying a WKHapticType
option.
WKInterfaceDevice.current().play(.success)
Here are the WKHapticType
options:
enum WKHapticType : Int {
case Notification
case DirectionUp
case DirectionDown
case Success
case Failure
case Retry
case Start
case Stop
case Click
}
Upvotes: 17
Reputation: 2191
Right now, it is impossible to do what you want to do.
First of all, keep in mind that it's really likely that you will be able to do what you want to do later this year (In late 2014, Apple published a press info stating : "Starting later next year, developers will be able to create fully native apps for Apple Watch.", http://www.apple.com/pr/library/2014/11/18Developers-Start-Designing-Apps-for-Apple-Watch.html).
If that's impossible, it's because right now, Apple Watch apps aren't really running on Apple Watch but on the iPhone that's paired with it.
When the user touches the icon of your app on the Apple Watch screen, Apple Watch tells your iPhone to launch the corresponding extension, this is the extension that's gonna run your code, update your UI, and respond to events such as when the user touch a button.
So to sum up quickly all of that, what's on Apple Watch is only the UI and some ressources, and that's the iPhone that runs the code you write.
When it will be possible to create fully native apps, Apple will probably provide frameworks that enable you to use the Taptic engine and other watch specific sensors.
I advise you to see the dedicated Apple Developper page for more details about WatchKit :
https://developer.apple.com/watchkit/
Here, you'll find a video for getting started with WatchKit, Framework reference and Design ressources.
Upvotes: 2
Reputation: 57139
There are no existing WatchKit APIs to send vibration patterns to the watch or to trigger vibration other than the default notification one. Your best option at the moment is to file an enhancement request.
Upvotes: 9