androidreact-nativeandroid-vibration

Vibration not ocurring on React-Native Android Device when unplugged


import { Vibration } from 'react-native';

const handleThrottledShake = () => {
  Vibration.vibrate(500);
  console.log('ran vibration');
}

I'm currently developing a react-native app and running into some trouble. When connecting my phone via a usb cable, vibration works. However, when I unplug it, everything else works, including console.log('ran vibration'); but no vibration actually occurs. The docs say say that vibration doesn't work on an emulator, but I'm using a physical device (OnePlus6), so I don't think that's the issue.

Does anybody have any ideas on what could be the problem?


Solution

  • Figured out the issue! Had nothing to do with React Native, it was actually my phone. My phone was on battery saver when unplugged, which apparently disabled the vibration.