diff --git a/app/src/main/kotlin/com/wire/android/media/PingRinger.kt b/app/src/main/kotlin/com/wire/android/media/PingRinger.kt index a802ce4ee25..7286193ceb7 100644 --- a/app/src/main/kotlin/com/wire/android/media/PingRinger.kt +++ b/app/src/main/kotlin/com/wire/android/media/PingRinger.kt @@ -88,10 +88,10 @@ class PingRinger @Inject constructor(private val context: Context) { if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) { appLogger.i("Starting vibration") if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - it.vibrate(VibrationEffect.createWaveform(VIBRATE_PATTERN, VibrationEffect.DEFAULT_AMPLITUDE)) + it.vibrate(VibrationEffect.createWaveform(VIBRATE_PATTERN, DO_NOT_REPEAT)) } else { @Suppress("DEPRECATION") - it.vibrate(VIBRATE_PATTERN, VibrationEffect.DEFAULT_AMPLITUDE) + it.vibrate(VIBRATE_PATTERN, DO_NOT_REPEAT) } } else { appLogger.i("Skipping vibration") @@ -101,6 +101,7 @@ class PingRinger @Inject constructor(private val context: Context) { } companion object { - private val VIBRATE_PATTERN: LongArray = longArrayOf(0L, 1000L, 1000L, 1000L) + val VIBRATE_PATTERN: LongArray = longArrayOf(50, 50, 100, 150, 200, 250) + const val DO_NOT_REPEAT = -1 // Do not repeat. } } diff --git a/app/src/main/kotlin/com/wire/android/notification/NotificationChannelsManager.kt b/app/src/main/kotlin/com/wire/android/notification/NotificationChannelsManager.kt index 3490875f3e5..af81f1014c6 100644 --- a/app/src/main/kotlin/com/wire/android/notification/NotificationChannelsManager.kt +++ b/app/src/main/kotlin/com/wire/android/notification/NotificationChannelsManager.kt @@ -28,6 +28,7 @@ import androidx.core.app.NotificationChannelCompat import androidx.core.app.NotificationChannelGroupCompat import androidx.core.app.NotificationManagerCompat import com.wire.android.appLogger +import com.wire.android.media.PingRinger import com.wire.kalium.logic.data.user.SelfUser import com.wire.kalium.logic.data.user.UserId import javax.inject.Inject @@ -170,6 +171,7 @@ class NotificationChannelsManager @Inject constructor( .Builder(NotificationConstants.getPingsChannelId(userId), NotificationManagerCompat.IMPORTANCE_HIGH) .setName(NotificationConstants.PING_CHANNEL_NAME) .setGroup(channelGroupId) + .setVibrationPattern(PingRinger.VIBRATE_PATTERN) .setSound(knockSoundUri, audioAttributes) .build()