Implement haptics on Android

Haptics is everything you feel through the sense of touch. Modern Android devices often incorporate a vibration actuator to allow devices to stimulate the user's sense of touch. These motors have advanced significantly from the original loud buzzy vibration produced by early devices, and Android apps can now take advantage of capabilities to give users a richer experience with subtlety and depth.

The following pages cover everything about vibration, from basic haptic feedback to increasingly more complex vibration waveforms and effect compositions.

Haptics design principles
The page describes the classifications supported by Android haptics and guidelines for designing them.
Add haptic feedback to events
The page presents code examples for different ways of providing haptic feedback to user interactions.
Vibration actuators primer
The page provides an overview of how vibration actuators work, which is important prerequisite knowledge for creating custom haptics.
Create custom haptic effects
This page provides several examples of using different haptics APIs to create custom effects in an Android application.
Add haptics APIs
The page is a reference for various haptics APIs available on Android, and also covers when and how to check for any device support necessary to ensure your Haptic effects play as intended.

Also, be sure to read the best practices for accessibility.

Samples

The following samples are available in the Haptic Sampler app on GitHub. You can also find documentation for each here.

This documentation also includes code examples for the following custom vibration patterns:

Video