Created
November 25, 2022 17:59
-
-
Save ikhlaqmalik13/231ba5a642f1b8cd8be3c5b162265e9e to your computer and use it in GitHub Desktop.
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
private lateinit var vibrator: Vibrator | |
vibrator = getSystemService(Context.VIBRATOR_SERVICE) as Vibrator | |
private fun vibrate() { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | |
vibrator.vibrate(VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE)); | |
} else { | |
vibrator.vibrate(500); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment