Skip to content

bug: Calling the Haptics.vibrate method too often hangs iOS #7

@Shahor

Description

@Shahor

Bug Report

Plugin(s)

https://capacitorjs.com/docs/apis/haptics#vibrate

Most recent versions (probably all)

Capacitor Version

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 5.5.1
  @capacitor/core: 5.5.1
  @capacitor/android: 5.5.1
  @capacitor/ios: 5.5.1

Installed Dependencies:

  @capacitor/cli: 4.8.1
  @capacitor/core: 4.8.1
  @capacitor/android: 4.8.1
  @capacitor/ios: 4.8.1


Platform(s)

  • iOS

I haven't checked on Android

Current Behavior

When Haptics.vibrate is called too often, especially while the previous calls haven't been finished yet, the phone will hang.

Expected Behavior

The haptics are triggered from a different thread than the main one so we don't block the app completely when doing trivial actions.

Code Reproduction

https://github.com/Shahor/capacitor-haptics-repro

Other Technical Details

As stated per the documentation, https://developer.apple.com/documentation/corehaptics/preparing_your_app_to_play_haptics/#3200019, core haptics is thread safe so it can be called from wherever without impact.

Additional Context

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions