androidreact-nativevibration

Is it possible to control vibration intensity with React Native?


I'm developing an Android app with React Native.

I want to control vibration intensity of Android phone but I cannot find the way in the API doc.

Is there any way to control vibration intensity with React Native?


Solution

  • I don't think there is a way to control the intensity. I think vibration is either on or off. However, you should be able to mock different intensities by using different vibration patterns. For example, a light intensity vibration could look like:

    Vibration.vibrate([15,1], true);
    

    And a heavy vibration pattern could look like:

    Vibration.vibrate([10,5], true);
    

    Where the first item in the array is the separation duration, the second item in the array is the vibration duration, and the true value tells the method to repeat.