1

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.

myoan
  • 401
  • 5
  • 14

1 Answers1

0

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
Community
  • 1
  • 1
andreszs
  • 2,896
  • 3
  • 26
  • 34
  • I am now trying to find a workaround, at least to differentiate short/long vibrations. Some people are using other Sound IDs that trigger vibrator https://github.com/tatatananana/cordova-plugin-vibration/commit/25c804bbe42b7eda0c8a6adf87c1f733d92f069c but it seems like the official Apple documentation does not even has a list of available sounds. Unofficial lists exist but I can't find the exact meaning of 1352 nor if other integers exist http://iphonedevwiki.net/index.php/AudioServices – myoan Jul 08 '18 at 13:11