Haptics

Haptics are small buzzes from the phone's vibration motor. Done well, they make a tap feel real. Done badly, they nag, drain the battery and feel cheap.

The one rule: a buzz confirms something the user did or must know now. Nothing else buzzes.

Principles

  1. Few and meaningful. Each buzz means one thing. Users learn it. If everything buzzes, nothing means anything.
  2. Tied to an action or a moment. A buzz happens at the same instant as the tap, the snap or the result. Never late, never on its own.
  3. Short and crisp. UI buzzes are under 30 ms each. Crisp beats strong.
  4. Never the only signal. Every buzz goes with something you can see or hear (Accessibility).
  5. The user is in charge. One switch turns all UI buzzes off. The system's own "touch feedback" setting is respected too.
  6. Quiet when quiet. No UI buzzes during a call, in Do Not Disturb (except alarms) or when the screen is off.

The haptic set

These are the only UI buzzes. Use the name in code and in reviews.

TokenFeels likeUse forAndroid (first choice)Fallback
haptic-tickthe lightest tapsliders and pickers stepping, a list snapping, a segment changingHapticFeedbackConstants.SEGMENT_TICK (API 34) or CLOCK_TICKPRIMITIVE_TICK, then EFFECT_TICK
haptic-clicka firm tapa toggle, a chip, a tab, a button that does something small, mic onTOGGLE_ON / TOGGLE_OFF (API 34), else CONTEXT_CLICKPRIMITIVE_CLICK, then EFFECT_CLICK
haptic-confirma tap with a little liftsomething saved, sent or done: answer finished, item added, event savedCONFIRMEFFECT_DOUBLE_CLICK
haptic-rejecttwo short knockssomething failed or was refused: error, can't do thatREJECT2 × PRIMITIVE_CLICK, 60 ms apart
haptic-heavya deep thudlong press, drag start, a destructive step (delete) armedLONG_PRESS or DRAG_START (API 34)EFFECT_HEAVY_CLICK
haptic-attentiona soft risethe assistant needs you now: an approval card appearsPRIMITIVE_QUICK_RISE + PRIMITIVE_CLICKEFFECT_CLICK

Not UI buzzes, and handled by their own system:

KindPatternUsageRule
Alarm600 on, 400 off, 600 on, 1400 off, repeatUSAGE_ALARMRings through Do Not Disturb. Stops the moment the alarm is dismissed or snoozed.
Notificationthe channel's settingUSAGE_NOTIFICATIONLet the notification channel buzz, never the app by hand. The user controls it in Android settings.

Which to pick

Did the user just touch something?
  ├─ it moves in steps (slider, picker, snap)  → haptic-tick
  ├─ it switches or selects                    → haptic-click
  ├─ it is a long press or drag                → haptic-heavy
Did something finish?
  ├─ it worked                                 → haptic-confirm
  ├─ it failed                                 → haptic-reject
Does the assistant need the user right now?    → haptic-attention
Anything else                                  → no buzz

When to buzz in AssistX

MomentBuzz
Send a messagehaptic-click
Answer finishedhaptic-confirm (once per answer)
Answer streaming innone
Approval card appearshaptic-attention + the approval sound
Turn errorhaptic-reject + the error sound
Toggle in Settingshaptic-click
Item added, event saved, job runhaptic-confirm
Delete confirmedhaptic-confirm (the arming long press was haptic-heavy)
Mic / dictation startshaptic-click
Voice mode: the assistant starts talkingnone (the sound is enough)
Pull to refresh passes the thresholdhaptic-tick
Alarm ringsalarm pattern
Background work, Mind runs, syncnever

How to code it

Android (Kotlin)

1. Prefer the view's own feedback. It needs no permission, follows the user's system setting, and the phone maker tunes it for its motor.

view.performHapticFeedback(HapticFeedbackConstants.CONFIRM)

2. For the web page, go through the bridge. The page calls NativeApp.haptic(kind) with a token name. Kotlin maps it to a constant and runs it on the WebView:

@JavascriptInterface
fun haptic(kind: String) = runOnUiThread {
    val c = when (kind) {
        "tick" -> if (SDK_INT >= 34) HapticFeedbackConstants.SEGMENT_TICK else HapticFeedbackConstants.CLOCK_TICK
        "click" -> HapticFeedbackConstants.CONTEXT_CLICK
        "confirm", "success" -> HapticFeedbackConstants.CONFIRM
        "reject", "error" -> HapticFeedbackConstants.REJECT
        "heavy" -> HapticFeedbackConstants.LONG_PRESS
        else -> return@runOnUiThread
    }
    web.performHapticFeedback(c)
}

3. Only when no constant fits, use a composition. Check the motor can play it first; old or cheap motors can't.

val v = getSystemService(VibratorManager::class.java)?.defaultVibrator ?: return
if (!v.hasVibrator()) return
val fx = if (v.areAllPrimitivesSupported(PRIMITIVE_QUICK_RISE, PRIMITIVE_CLICK))
    VibrationEffect.startComposition()
        .addPrimitive(PRIMITIVE_QUICK_RISE, 0.5f)
        .addPrimitive(PRIMITIVE_CLICK, 0.8f, 40)
        .compose()
else VibrationEffect.createPredefined(VibrationEffect.EFFECT_CLICK)
vibrate(v, fx, usage = USAGE_TOUCH)

4. Always say what the buzz is for. Pass a usage, so the system can apply the user's settings (touch, alarm, notification strength). VibrationAttributes is API 33; the app's minSdk is 31, so guard it:

fun vibrate(v: Vibrator, fx: VibrationEffect, usage: Int) {
    if (SDK_INT >= 33) v.vibrate(fx, VibrationAttributes.createForUsage(usage))
    else v.vibrate(fx, AudioAttributes.Builder().setUsage(
        if (usage == VibrationAttributes.USAGE_ALARM) AudioAttributes.USAGE_ALARM
        else AudioAttributes.USAGE_ASSISTANCE_SONIFICATION).build())
}

5. Raw waveforms only for alarms. Hand-made createWaveform timings feel buzzy on most motors, and ignore the user's strength settings. The alarm is the one exception.

6. Stop what you start. A repeating pattern (repeat = 0) must be cancelled in every exit path: dismiss, snooze, timeout, service destroyed.

Web page

The page never calls the motor itself inside the app. It calls one helper:

hap("confirm");   // tick | click | confirm | reject | heavy | attention

hap() checks the user's Vibration switch, drops repeats (one tick per 40 ms, any buzz at most 10 per second) and calls NativeApp.haptic. Outside the app it falls back to navigator.vibrate with a short time (5-20 ms). iPhones' Safari has no navigator.vibrate; nothing happens, and that is fine.

Battery and comfort

Accessibility

Testing

Never

Gaps

Where the app differs today (checked 2026-11-25). index.html is the app page, android/app/src/main/assets/index.html (same file as server/examples/dummy-client/index.html). Kotlin files are in android/app/src/main/java/app/assistant/.

  1. Alarm can crash on Android 12. RingService.kt:82-84 calls vibrate(effect, VibrationAttributes), which is API 33. The app's minSdk is 31, and there is no version check. Guard it as in step 4.
  2. Buzzing while the answer streams. index.html:1816 calls hapTalk() on every message.delta, about 7 buzzes a second for the whole answer. Remove it; keep one confirm when the answer is done.
  3. No usage on UI buzzes. MainActivity.kt:736-745 calls vibrate(fx) with no attributes, so Android's touch feedback setting is ignored. Switch to performHapticFeedback on the WebView.
  4. Hand-made waveforms for success and error (MainActivity.kt:741-742). Use CONFIRM and REJECT.
  5. Send uses heavy (index.html:1975). Send is a normal action: use click. Keep heavy for long press, drag and arming a risky step (the unrestricted-command card at :1761 is right).
  6. No attention token yet. Approval cards use click (index.html:1814).
  7. No hasVibrator() check before vibrating (MainActivity.kt:737).
  8. The page's names are success / error; the tokens are confirm / reject. The bridge should accept both until the page is updated.

Try the haptic set

Open this page on an Android phone to feel each one. Everywhere else the pad shows it.

Browser buzzes are rough copies. The app uses Android's tuned effects (CONFIRM, REJECT…).