BinaryEye
BinaryEye copied to clipboard
Vibrate on scan not working on Android 13
The Option "Vibrate on detection" does not lead to a vibration on detection on Android 13. On an older device using Android 11, this setting works as expected.
I tried using this code:
fun Context.getVibrator(): Vibrator = if (beforeS) { @Suppress("DEPRECATION") getSystemService(Context.VIBRATOR_SERVICE) as Vibrator } else { (getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager).defaultVibrator }
instead of:
fun Context.getVibrator(): Vibrator = if (beforeS) { @Suppress("DEPRECATION") getSystemService(Context.VIBRATOR_SERVICE) as Vibrator } else { (getSystemService(Context.VIBRATOR_MANAGER_SERVICE) as VibratorManager).defaultVibrator }
inside the Vibrator.kt, sadly that did not solve the problem.
Feel free to ask for tests or more information.
I'm not an Android developer, so the only other idea I had was to set the amplitude of the vibration to 255, but this did not change the behavior.
I tested on a Pixel 4a 5g and a Pixel 4a with Android 13, and on a Fairphone 4 with Android 11.
Hm, this is strange 🤔 Thanks for filing an issue! 👍
Curiously it works on my Pixel 7 Pro with Android 13, which is the only device with Android 13 that I have at the moment, unfortunately. So I will have to do some research, and get my hands on more devices running Android 13 to track this down.
But I guess it may have something to do with the duration. Does it work when you increase the DURATION_IN_MS
value to 500L
in Vibrator.kt?
changing the DURATION_IN_MS
to 500L
does change the behavior.
Interesting! Thanks for testing this! 👍
I increased the duration to 250 ms for the next release (in 6a63bc4e061b3b9fbe157a835435fd652dac1469), which is hopefully enough (500 ms is quite a bit long I guess).
Oh damn, my bad. Was supposed to say doesn't :(
Ah, okay 😉 So it's not the duration 🙈
On my Pixel 7 Pro (as already confirmed by Markus) but also on my Samsung Tab S6 on Android 13 it's working how it should be.