android source

vibratePhone()

리오파파 2019. 7. 23. 12:49

vibrate phone with pattern

 

refer to KeepItSilent.apk

private static void vibratePhone(Context context) {
  long[] pattern = {0, 100, 1000, 300, 200, 100, 500, 200, 100};
  Vibrator v = (Vibrator) context.getSystemService(VIBRATOR_SERVICE);
  assert v != null;
  v.vibrate(VibrationEffect.createWaveform(pattern, -1));
}