android source

phone vibrate

리오파파 2023. 12. 17. 20:09

 

VibratorManager vibratorManager;
Vibrator vibrator = null;
VibrationEffect vibrationEffect = null;
final long[] vibPattern = {70, 70, 70, 70};
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
vibratorManager =
(VibratorManager) context.getSystemService(Context.VIBRATOR_MANAGER_SERVICE);
vibrator = vibratorManager.getDefaultVibrator();
vibrationEffect = VibrationEffect.createWaveform(vibPattern, -1);
}
vibrator.cancel();
vibrator.vibrate(vibrationEffect);

'android source ' 카테고리의 다른 글

Google File Async Download  (0) 2023.12.17
drawable resource를 bitmap으로  (1) 2023.12.17
Phone Metric 얻기  (0) 2023.12.17
bitmap <-> string  (0) 2023.12.17
layer xml로 버튼모양 만들기  (0) 2023.12.17