Skip to main content

advanced_haptics 1.2.0 copy "advanced_haptics: ^1.2.0" to clipboard
advanced_haptics: ^1.2.0 copied to clipboard

A Flutter plugin for playing advanced, custom haptic feedback patterns on Android and iOS, including waveforms and Core Haptics .ahap files.

Changelog #

All notable changes to advanced_haptics will be documented in this file.


1.2.0 #

  • NEW: AGP 9 built-in Kotlin support, following Flutter's plugin migration guide. The Android build file no longer applies the Kotlin Gradle plugin (KGP) when AGP 9's built-in Kotlin is active (android.builtInKotlin=true), configures jvmTarget through the kotlin.compilerOptions DSL, and declares kotlin-test-junit5 explicitly for its unit tests (only KGP swaps a bare kotlin-test for the JUnit 5 variant).
  • Existing setups keep working unchanged: with built-in Kotlin disabled (what Flutter's templates write), Flutter 3.44+ applies KGP to plugin projects itself, and on older Flutter versions the plugin applies KGP as before. The minimum Flutter version is unchanged. Verified with Flutter 3.38.0 (AGP 8.11 / KGP 2.2.20), 3.44.8 (AGP 9.0.1, legacy mode) and 3.47.4 (AGP 9.1.0, built-in Kotlin).
  • Enabling built-in Kotlin in an app needs Flutter 3.47 or newer: Flutter 3.44's tooling applies KGP to every plugin regardless of the setting, which AGP 9 rejects; 3.47 gates that on android.builtInKotlin. Keep the org.jetbrains.kotlin.android ... apply false declaration (2.2.20+) in settings.gradle(.kts), since Flutter's version check reads it even though it is never applied.
  • The example app keeps Flutter's template defaults (android.builtInKotlin=false); the README explains how to switch.

1.1.0 #

Design one pattern, play it everywhere.

  • NEW: HapticPattern, HapticTransient, HapticContinuous and HapticPatternBuilder: a platform-independent pattern model with intensity and sharpness per event. AdvancedHaptics.playPattern() renders it as Core Haptics events on iOS, as VibrationEffect.Composition primitives on Android 11+ (tap-only patterns, TICK/CLICK/THUD chosen by sharpness), and as a waveform everywhere else. HapticPattern.toWaveform() exposes the flattening for callers who want the raw waveform.
  • NEW: AndroidHapticPrimitive, AndroidPrimitiveEvent and AdvancedHaptics.playComposition(): direct access to Android's composition primitives (click, tick, thud, spin, quickRise, slowRise, quickFall, lowTick). Unsupported devices and Android below API 30 get a waveform approximation; iOS renders the closest Core Haptics events, so the call is safe on every platform.
  • NEW: AdvancedHaptics.supportsAndroidPrimitives() reports native primitive support (API 30+ and hardware).
  • Compositions and predefined effects cannot be paused; patterns played as waveforms or Core Haptics can.

1.0.10 #

  • CHORE: Bumped flutter_lints to ^6.0.0 (dev dependency only; no runtime changes). The package and example analyze cleanly under the current lint set.

1.0.9 #

Robustness release: every method is now safe to call on any platform and device.

  • FIX: AndroidPredefinedHaptic used wrong effect IDs (pop/thud/ringtone1 mapped to ringtone effects). IDs now match android.os.VibrationEffect; added textureTick. Unsupported effects fall back to click (API 30+).
  • FIX: cancel(), pause(), resume() and seek() threw MissingPluginException on Android.
  • NEW: pause(), resume() and seek() now work on Android. The vibrator has no native pause, so the plugin tracks the position inside the playing waveform, cancels on pause and replays the remainder (looping included) on resume or seek. PLAYER_NIL is thrown when nothing is playing, matching iOS.
  • FIX: stop() and cancel() on iOS threw PLAYER_NIL when nothing was playing. They are now idempotent.
  • FIX: atTime on iOS was passed as an absolute engine time, so scheduled playback/pause/resume/stop never worked. It is now a delay in seconds from now.
  • FIX: iOS devices without Core Haptics (iPads, iPhone 7 and older) threw UNSUPPORTED on every call. They now fall back to UIFeedbackGenerator.
  • FIX: iOS engine reset/stop handlers mutated state off the main thread, and a stale player could block new playback after an engine reset.
  • FIX: Repeating waveforms on iOS ignored trailing silence (loopEnd was never set).
  • FIX: Android crashed with ClassCastException when timings exceeded 32 bits, and SecurityException (missing VIBRATE permission) was not caught.
  • FIX: hasCustomHapticsSupport() could throw on platforms without a native implementation or when the native side returned null.
  • NEW: playWaveform(repeat: ...) is now a real parameter (it was documented but ignored).
  • NEW: Dart-side argument validation with clear ArgumentErrors (empty lists, mismatched lengths, negative timings, amplitudes outside 0-255, bad repeat, negative times).
  • NEW: Android below API 26 plays the on/off shape of a waveform (previously a fixed 200 ms buzz); playPredefined plays an approximation below API 29 instead of erroring. Uses VibratorManager on API 31+.
  • NEW: Very short iOS waveform segments (< 40 ms) are rendered as transient taps, which are far more perceptible.
  • NEW: playAhap accepts absolute file paths in addition to Flutter asset paths.
  • NEW: AdvancedHapticsPlatform is now a real platform interface: replace AdvancedHapticsPlatform.instance with a mock in tests.
  • NEW: iOS sources ship as a Swift package (ios/advanced_haptics/Package.swift) with a privacy manifest, so apps built with Swift Package Manager (default since Flutter 3.44) no longer fall back to CocoaPods. The podspec is kept for CocoaPods users.
  • CHORE: Real Dart and Kotlin unit tests; podspec metadata; plugin build.gradle moved to Java 17 / compileSdk 36 and no longer double-applies the Kotlin plugin under AGP 9.
  • CHORE: Example app modernised: Gradle 9.1 / AGP 9.0.1 / Kotlin 2.3.20 (it could not build on the JDK current Flutter uses), iOS deployment target 13.0 (the podspec minimum), error reporting in the UI, demos for looping waveforms, predefined effects and player controls.

1.0.8 #

Updated ReadMe


1.0.7 #

Contributor: @rdeekshitha-scapia — #4

  • FIX: Lowered minSdkVersion from 26 to 21, allowing the plugin to be used in apps targeting Android 5.0+. API 26 (Oreo) haptic requirements are now enforced at runtime via a centralized hasOreoHaptics() check rather than at the build level.

1.0.6 #

Contributor: @kvenn — kvenn/bug-foreground-restart

  • FIX: Resolved an issue where lightTap() and mediumTap() were not triggering haptic feedback on iOS (e.g. iPhone 13 Pro, iOS 18), while success() worked correctly. Reported in #2.

1.0.5 #

  • FIX: Resolved a build error on iOS versions below 16 caused by use of CHHapticPattern(contentsOf:), which is only available in iOS 16+. Implemented a fallback using manual AHAP JSON decoding and CHHapticPattern(dictionary:) for compatibility with iOS 13–15.

1.0.4 #

  • Updated README.

1.0.3 #

  • Added platform-specific methods for iOS.
  • Improved README structure and organization.

1.0.2 #

  • Added platform-specific methods for Android.

1.0.1 #

  • Updated README.

1.0.0 #

  • Proper launch of advanced_haptics.

0.0.6 #

  • FIX: Resolved a build error on iOS (Cannot find type 'CHHapticPlayer' in scope) by adding the necessary CoreHaptics framework import.

0.0.5 #

  • Fixed playback issues on iOS in the waveform method.

0.0.4 #

  • Fixed playback issues on iOS in the waveform method.

0.0.3 #

  • Fixed bug in iOS.

0.0.2 #

  • Updated README.

0.0.1 #

  • Initial release of the advanced_haptics package.
  • Support for Android waveform patterns.
  • Support for iOS Core Haptics via .ahap files.
  • Added predefined patterns and device support checking.
5
likes
160
points
1.34k
downloads

Documentation

API reference

Publisher

verified publisherfendomoney.com

Weekly Downloads

A Flutter plugin for playing advanced, custom haptic feedback patterns on Android and iOS, including waveforms and Core Haptics .ahap files.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on advanced_haptics

Packages that implement advanced_haptics