List of usage examples for android.view InputDevice getVibrator
public Vibrator getVibrator()
From source file:info.bartowski.easteregg.MLand.java
private void thump(int playerIndex, long ms) { if (mAudioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT) { // No interruptions. Not even game haptics. return;//from ww w.j av a 2 s . co m } if (playerIndex < mGameControllers.size()) { int controllerId = mGameControllers.get(playerIndex); InputDevice dev = InputDevice.getDevice(controllerId); if (dev != null && dev.getVibrator().hasVibrator()) { Utility.compatVibrate(dev.getVibrator(), (long) (ms * CONTROLLER_VIBRATION_MULTIPLIER)); return; } } Utility.compatVibrate(mVibrator, (long) (ms * CONTROLLER_VIBRATION_MULTIPLIER)); }