Merge pull request #107385 from Alex2782/fix_vibrate_android
Fix `Input.vibrate_handheld` on Android.
This commit is contained in:
commit
6845898461
@ -1011,6 +1011,7 @@ class Godot(private val context: Context) {
|
||||
@Keep
|
||||
private fun vibrate(durationMs: Int, amplitude: Int) {
|
||||
if (durationMs > 0 && requestPermission("VIBRATE")) {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
if (amplitude <= -1) {
|
||||
vibratorService.vibrate(
|
||||
@ -1031,6 +1032,9 @@ class Godot(private val context: Context) {
|
||||
// deprecated in API 26
|
||||
vibratorService.vibrate(durationMs.toLong())
|
||||
}
|
||||
} catch (e: SecurityException) {
|
||||
Log.w(TAG, "SecurityException: VIBRATE permission not found. Make sure it is declared in the manifest or enabled in the export preset.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user