tauri-apps / plugins-workspace

All of the official Tauri plugins in one place!
https://tauri.app
Apache License 2.0
966 stars 272 forks source link

[Bug] Haptics plugin not working on Google Pixel 9 Pro XL #2023

Open httpjamesm opened 1 week ago

httpjamesm commented 1 week ago

Attempting to call any of the four vibration functions from the haptics (@tauri-apps/plugin-haptics) plugin does nothing. No errors are returned nor sent in the device logs.

Using:

FabianLars commented 6 days ago

For more context the discord discussion that started after i asked for more testers (mostly me talking lol): https://discord.com/channels/616186924390023171/618328921330417692/1304856255269048430

Do you have the Haptic Feedback OS setting disabled? The APIs are fairly sensitive to that apparently. A short summary of the linked discord messages:

With haptic feedback disabled:

With haptic feedback enabled:

if you could confirm this behavior on your end that would be much appreciated - Edit: Don't forget to enable the haptics apis in the capabilities file. Since i forgot to push the Guide this seems to be a common mistake


Now the question is how to solve this. Is this just something that should be documented? Or should we add the workarounds and make the apis work regardless of the user's settings?

If it matters, i stole the timings/amplitudes from other projects, mainly the capacitor plugin.

httpjamesm commented 6 days ago

Issue resolved. These permissions need to be added to the default.json capabilities file rather than just haptics:default:

[
        "haptics:allow-vibrate",
        "haptics:allow-impact-feedback",
        "haptics:allow-selection-feedback",
        "haptics:allow-notification-feedback"
]