You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Check if vibration duration is > 0 on Android
(cherry picked from commit 47f338fc12)
This commit is contained in:
committed by
Rémi Verschelde
parent
1b585634f1
commit
2abf2a6622
@@ -442,7 +442,7 @@ public class Godot extends Fragment implements SensorEventListener, IDownloaderC
|
|||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
@Keep
|
@Keep
|
||||||
private void vibrate(int durationMs) {
|
private void vibrate(int durationMs) {
|
||||||
if (requestPermission("VIBRATE")) {
|
if (durationMs > 0 && requestPermission("VIBRATE")) {
|
||||||
Vibrator v = (Vibrator)getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
Vibrator v = (Vibrator)getContext().getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
if (v != null) {
|
if (v != null) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
|
|||||||
Reference in New Issue
Block a user