Skip to content

Commit

Permalink
Fixed issues with VibratorManager
Browse files Browse the repository at this point in the history
  • Loading branch information
U7484052 committed Oct 29, 2023
1 parent 80b4b3f commit 7104fa6
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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;
}
Expand Down

0 comments on commit 7104fa6

Please sign in to comment.