Skip to content

feat(android): implement native haptics engine#3

Open
giannisantinelli wants to merge 1 commit into
Renegades-Studio:mainfrom
giannisantinelli:feat/android-support
Open

feat(android): implement native haptics engine#3
giannisantinelli wants to merge 1 commit into
Renegades-Studio:mainfrom
giannisantinelli:feat/android-support

Conversation

@giannisantinelli

Copy link
Copy Markdown

Summary

Android was a stub — this implements the Tickle Nitro spec on top of
Vibrator/VibrationEffect. iOS remains the primary Core Haptics target;
Android is a documented approximation.

  • intensity → vibration amplitude (API 26+; degrades to on/off timing without amplitude control)
  • sharpness → composition primitives on API 30+ (crisp CLICK/TICK vs dull THUD) for transient
    patterns and system haptics; ignored on the continuous/waveform path
  • Continuous players re-issue short, throttled amplitude ramps to mask the actuator-brake seams
    Android imposes when an effect is superseded
  • Custom patterns render events + intensity curves into a sampled, run-length-encoded waveform
  • System haptics (impact/notification/selection) map to primitives with predefined/one-shot fallbacks
  • Global enable flag persisted in SharedPreferences
  • Declares the VIBRATE permission; README documents the approximations

Testing

Built and manually tested on a physical Pixel 7a (Android 16): transient sharpness,
system-haptic styles, notification sequences, and continuous-intensity drags.

Notes

  • No JS API changes — implements the existing spec on a new platform.

Android was a stub; this implements the Tickle Nitro spec on top of
Vibrator/VibrationEffect. iOS remains the primary (Core Haptics) target,
and Android is an approximation:

- intensity -> vibration amplitude (API 26+ amplitude control; degrades
  to on/off timing on devices without it)
- sharpness -> composition primitives on API 30+ (crisp CLICK/TICK vs
  dull THUD) for transient patterns and system haptics; ignored on the
  continuous/waveform path, which has no primitive equivalent
- continuous players re-issue short, throttled amplitude ramps to mask
  the actuator-brake seams Android imposes when an effect is superseded
- custom patterns render events + intensity curves into a sampled,
  run-length-encoded amplitude waveform
- system haptics (impact/notification/selection) map to composition
  primitives with predefined/one-shot fallbacks on older devices
- persists the global enable flag in SharedPreferences

Declares the VIBRATE permission and documents the Android approximations
in the README.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants