Last active
November 13, 2017 11:24
-
-
Save nieldeokar/eea1dfa46ac7a54d5ee2dc0adc9eeee8 to your computer and use it in GitHub Desktop.
This method would create a one shot vibration using VibrationEffects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequiresApi(api = Build.VERSION_CODES.O) | |
private void createOneShotVibrationUsingVibrationEffect() { | |
// 1000 : Vibrate for 1 sec | |
// VibrationEffect.DEFAULT_AMPLITUDE - would perform vibration at full strength | |
VibrationEffect effect = VibrationEffect.createOneShot(1000, VibrationEffect.DEFAULT_AMPLITUDE); | |
vibrator.vibrate(effect); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment