apache / cordova-plugin-vibration

Apache Cordova Vibration Plugin
https://cordova.apache.org/
Apache License 2.0
127 stars 129 forks source link

doesn't work #110

Open almaz1213 opened 2 years ago

almaz1213 commented 2 years ago

Bug Report

Problem

Android Studio Logcat: E/Capacitor/Console: File: http://localhost/main.26d719c053273456.js - Line 1 - Msg: Blocked call to navigator.vibrate because user hasn't tapped on the frame or any embedded frame yet: https://www.chromestatus.com/feature/5644273861001216

breautek commented 2 years ago

This plugin relies on the webview implementation for the android platform. Unfortunately, based on the chrome status link, as of webview 60, it requires a trusted user event to be triggered before it will allow the vibrate API to be invoked.

Possible workaround is to use v2.x of this plugin, which contains a native implementation, instead of relying on the browser implementation (however it may or may not work with modern tooling, I haven't tested it).

van9petryk commented 11 months ago

They should remove WebView implementation and restore native. Just tried v2 and works fine. With v3 I was unable to trigger vibration (POCO X3 NFC).