package de.markusfisch.android.binaryeye.app

import android.os.Build
import android.os.VibrationEffect
import android.os.Vibrator

fun Vibrator.vibrate() {
	if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
		@Suppress("DEPRECATION")
		this.vibrate(100)
	} else {
		this.vibrate(VibrationEffect.createOneShot(100, 10))
	}
}

package de.markusfisch.android.binaryeye.app

import android.os.Build
import android.os.VibrationEffect
import android.os.Vibrator

private const val MILLISECONDS = 100L

fun Vibrator.vibrate() {
	if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
		@Suppress("DEPRECATION")
		this.vibrate(MILLISECONDS)
	} else {
		this.vibrate(VibrationEffect.createOneShot(
			MILLISECONDS,
			VibrationEffect.DEFAULT_AMPLITUDE)
		)
	}
}

Fix vibrating for Android O and higher
Fix vibrating for Android O and higher

The amplitude was too small.

markusfisch/BinaryEye,markusfisch/BinaryEye