Open jan-koz opened 10 months ago
Yes, it's true.
Vibration.vibrate() with custom duration has no impact on iOS: Call AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) when not specified pattern argument: `
guard let pattern = myArgs["pattern"] as? [Int] else {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
result(true)
return
}
if pattern.count == 0 {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
result(true)
return
}
`
Canceling vibration on iOS is not working:
There is no implementation:
case "cancel": result(nil)
Yes, it's true.
- Vibration.vibrate() with custom duration has no impact on iOS: Call AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) when not specified pattern argument: `
guard let pattern = myArgs["pattern"] as? [Int] else { AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) result(true) return } if pattern.count == 0 { AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) result(true) return }
`
- Canceling vibration on iOS is not working: There is no implementation:
case "cancel": result(nil)
This should be mentioned in the documentation to allow end users to utilise this library to its max potential 🌟 Until I discovered this issue, I legit believed there's something wrong with my iPhone 11 😆
Pasting a quick working sample for future readers. Use this code on iOS to control vibration intensity to your liking:
Future<void> vibrate() async {
final canVibrate = await Vibration.hasVibrator() ?? false;
if (canVibrate) {
await Vibration.vibrate(pattern: [16], intensities: [200]);
}
}
Here, pattern
can be considered as duration
, and intensities
define how strong should the vibration(s) be.
Calling Vibration.vibrate() with custom duration has no impact on iOS, vibration length is 500 ms. It's possible to vibrate with pattern to achieve custom duration. Also as in title canceling vibration on iOS is not working. Checked on iPhone 13, iOS 16.1.1