WatchKit / Apple Watch API: vibrations of custom length?

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.


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.


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
}

Tags:

Ios

Watchkit