Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
httpjamesm opened this issue Nov 9, 2024 · 2 comments
Open

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

httpjamesm opened this issue Nov 9, 2024 · 2 comments
Labels
bug Something isn't working plugin: haptics

Comments

@httpjamesm
Copy link

httpjamesm commented Nov 9, 2024

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:

  • haptics version ~2
  • @tauri-apps/api ^2.0.3
  • Android 15
@FabianLars FabianLars added bug Something isn't working plugin: haptics help wanted Extra attention is needed and removed help wanted Extra attention is needed labels Nov 9, 2024
@FabianLars
Copy link
Member

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:

  • vibrate() only works with values (those are in miliseconds btw) above 1000. So 1001 vibrates, 1000 and below doesn't
    • changing it to the waveform api, using the workaround mentioned below, should make it work too ig
  • impact and selection does nothing
  • notification (warning) does vibrate
    • The difference is that the vibration waveform of notification is of length 4, while the other 2 use a length 2 array. If i make all of them use length 4 by appending 0 values (meaning amplitude 0, timing 0) they also start to work

With haptic feedback enabled:

  • vibrate() works with values below 1000
  • impact and selection work without the workaround
  • notification still works

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
Copy link
Author

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"
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugin: haptics
Projects
None yet
Development

No branches or pull requests

2 participants