Cordova振动不工作 [英] Cordova vibrate is not working

查看:406
本文介绍了Cordova振动不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android上运行Cordova,这是我的配置文件。

I'm running Cordova on Android and this is my config files.

config.xml

config.xml

<feature name="Vibration">
    <param name="android-package" value="org.apache.cordova.vibration.Vibration" />
</feature>
<feature name="Media">
    <plugin name="Media" value="org.apache.cordova.AudioHandler" />
</feature>
<feature name="Notification">
    <param name="android-package" value="org.apache.cordova.Notification" />
</feature>

AndroidManifest.xml

AndroidManifest.xml

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />

my js

navigator.vibrate(1000);

我使用正常的jQuery(非jQueryMobile)来运行cordova。

Vibration已通过此页面的命令行安装的插件(plugin git )

I use normal jQuery (Not jQueryMobile) to run with cordova.
Vibration plugin as already installed by command line from this page (plugin git).

但是振动不起作用。

推荐答案

p>我知道这是一个老线程,但是,当测试在设备上,请确保设备已取消静音。许多(大多数)设备将静音振动以及音频。如果你在浏览器中调试,你应该在控制台中看到振动1000毫秒,这告诉你插件是工作的(显然你不能振动你的计算机)。但是,再次,当在设备上测试时,请确保它不是静音。

I know this is an old thread, but, when testing on a device, be sure that the device is un-muted. Many (most) devices will "mute" the vibration as well as the audio. If you are debugging in the browser, you should see 'Vibrating for 1000ms.' in the console, which tells you the plugin is working (obviously you can't vibrate your computer). But, again, when testing on a device, be sure it's not on mute.

这篇关于Cordova振动不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆