From 7104fa66afaeea3f8fd17ad734ca796ee7d15dc4 Mon Sep 17 00:00:00 2001 From: U7484052 Date: Sun, 29 Oct 2023 16:43:48 +1100 Subject: [PATCH] Fixed issues with VibratorManager --- .../com/codename1/impl/android/AndroidImplementation.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java b/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java index e6439b6138..41c5abc597 100644 --- a/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java +++ b/Ports/Android/src/com/codename1/impl/android/AndroidImplementation.java @@ -52,6 +52,7 @@ import android.media.AudioManager; import android.net.Uri; import android.os.Vibrator; +import android.os.VibratorManager; import android.telephony.TelephonyManager; import android.util.DisplayMetrics; import android.util.Log; @@ -2614,7 +2615,7 @@ public void vibrate(int duration) { * Implementation takes into account for retrocompatability if the * SDK ever needs to be reverted to pre 31 for some reason? */ - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + if (Build.VERSION.SDK_INT >= 31) { // SDK >= 31 VibratorManager vibratorManager = (VibratorManager) getSystemService(Context.VIBRATOR_MANAGER_SERVICE); v = vibratorManager.getDefaultVibrator(); @@ -2623,7 +2624,7 @@ public void vibrate(int duration) { v = (Vibrator) getContext().getSystemService(Context.VIBRATOR_SERVICE); } } catch (Throwable e) { - Log.e("Codename One", "problem with virbrator(0)", e); + Log.e("Codename One", "problem with vibrator(0)", e); } finally { this.vibrateInitialized = true; }