diff --git a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPPreNotificationService.java b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPPreNotificationService.java index e92e5af4a..7d893b60b 100644 --- a/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPPreNotificationService.java +++ b/TMessagesProj/src/main/java/org/telegram/messenger/voip/VoIPPreNotificationService.java @@ -18,6 +18,8 @@ import android.media.MediaPlayer; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; +import android.os.VibrationAttributes; +import android.os.VibrationEffect; import android.os.Vibrator; import android.provider.Settings; import android.text.SpannableString; @@ -357,7 +359,16 @@ public class VoIPPreNotificationService { // } extends Service implements AudioM } else if (vibrate == 3) { duration *= 2; } - vibrator.vibrate(new long[]{0, duration, 500}, 0); + long[] pattern = new long[]{0, duration, 500}; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + vibrator.vibrate( + VibrationEffect.createWaveform(pattern, 0), + new VibrationAttributes.Builder() + .setUsage(VibrationAttributes.USAGE_RINGTONE) // required for background apps + .build()); + } else { + vibrator.vibrate(pattern, 0); + } } } }