Last active
November 13, 2017 11:41
-
-
Save nieldeokar/51ef75cbcb93e6c57046ff8fdc2f68e2 to your computer and use it in GitHub Desktop.
It would create one shot vibration using VibrationEffect
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