Cordova does not vibrate as expected on iOS

1k Views Asked by At

In my Ionic 3.20 + cordova ios 4.5.4 app with cordova-plugin-vibration 3.0.1 and compiled against XCode 9.4.1, @ionic-native/vibration behaves this way on iPhone 7:

  • vibrates with a default duration if a single duration value is given; e.g. vibrate(40); will vibrate ~500ms
  • doesn't vibrate at all if a sequence is given; e.g. vibrate([100, 100, 100]);

The same app compiled on Android works well and vibrates as expected.

1

There are 1 best solutions below

1
andreszs On BEST ANSWER

This is a known issue with iOS. From the plugin's README:

OS Quirks time: Ignores the specified time and vibrates for a pre-set amount of time.

navigator.vibrate(3000); // 3000 is ignored