I'm trying to add vibration effects to my Android game. I found some code that seems to work, but it's deprecated. What's the current way to create and deploy a vibrator?
var vibrator:Vibrator = getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
vibrator.vibrate(createPredefined(EFFECT_CLICK))
}else{
vibrator.vibrate(50)
}
The parts that are showing up as deprecated are "VIBRATOR-SERVICE" and vibrate.vibrate(50).