Skip to content

Commit ad01b44

Browse files
authored
fix(haptics): Crash on Android API level under 29 (#508)
1 parent 86928ec commit ad01b44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/haptics/index.android.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export * from './common';
22

3-
import { Utils } from '@nativescript/core';
3+
import { Utils, Device } from '@nativescript/core';
44
import { HapticImpactType, HapticNotificationType } from './common';
55

66
export class Haptics {
@@ -52,7 +52,7 @@ function trigger(
5252

5353
if (!vibrator) return;
5454

55-
if (vibrator.hasVibrator()) {
55+
if (parseFloat(Device.sdkVersion) >= 29 && vibrator.hasVibrator()) {
5656
switch (type) {
5757
case 'notification':
5858
vibrator.vibrate(android.os.VibrationEffect.createPredefined(android.os.VibrationEffect.EFFECT_TICK));

0 commit comments

Comments
 (0)