Skip to content

Conversation

@zywek123
Copy link

Haptics not work when screen is locked, as mentioned in #94 which is not merged.
So, play kSystemSoundID_Vibrate, when haptic engine not works.

return
}

guard let pattern = myArgs["pattern"] as? [Int] else {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case the device will vibrate once if the pattern argument is not provided. For example, if you only provide duration.

@zywek123
Copy link
Author

zywek123 commented Jun 6, 2025

@benjamindean and what's wrong with that? What is the default behavior?

@benjamindean
Copy link
Owner

@benjamindean and what's wrong with that? What is the default behavior?

Users should be able to vibrate with only duration. And duration can be of any value.

@zywek123
Copy link
Author

zywek123 commented Jun 7, 2025

OK, will revert it.
But... It is not possible to support background vibrations automatically.
Apply my first commit in this PR, write a simple app which vibrates when You would use compass or whatever, on iPhone ofcourse, press or swipe to go to home screen...
App should vibrate using KSystemSoundID_VIbration, or whatever... but, the plugin did not receive an exception from CHHaptic. It sometimes happens when CHHaptic works when you're switching to another app, home screen or locking the screen.
The best idea is to add legacy parameter, but the flutter programmer should know when the app is not shown, then decide to vibrate using Core Haptics only when the app is visible, othervise with legacy: true parameter.

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.

3 participants