Android 浏览器震动检测与 JavaScript 的 Web 应用程序

发布于 2024-11-04 03:38:16 字数 330 浏览 8 评论 0原文

任何版本的 Android Web 浏览器都可以检测 javascript shake 事件吗?像这样的事情:
window.addEventListener('devicemotion', this, false);
我似乎找不到任何相关信息。

我正在使用 WKShake,此处引用:Javascript。监听 iPhone 震动事件吗?
我想知道这是否也适用于 Android。

Do any versions of androids web browser detect javascript shake events? Something like this:
window.addEventListener('devicemotion', this, false);
I can't seem to find any information on this.

I am using WKShake which is refrenced here: Javascript. Listen for iPhone shake event?
and am wondering if this is going to work on android as well.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

故人爱我别走 2024-11-11 03:38:16

经过一些研究,我发现 Android 浏览器无法访问加速度计数据。也许在未来的某个时候他们将允许浏览器访问这些数据。

After some research, I have discovered that the android browser does not have access to accelerometer data. Perhaps some time in the future they will allow the browser to access this data.

停顿的约定 2024-11-11 03:38:16

Shake.js (http://functionn.blogspot.com/2012/03/shakejs-custom-shake-event-javascript.html) 是一个自定义“摇动”事件 JavaScript 插件,适用于使用设备加速计的移动 Web 浏览器。您的网络浏览器必须支持 devicemotion 事件才能使该插件正常工作。 Shake.js 使用内置功能检测来确定它是否可以在您的 Web 浏览器中运行。它将在不支持的浏览器上静默终止。

Shake.js (http://functionn.blogspot.com/2012/03/shakejs-custom-shake-event-javascript.html) is a custom 'shake' event JavaScript plugin for mobile web browsers using device accelerometer. Your web browser must support the devicemotion event for this plugin to work. Shake.js uses built-in feature detection to determine if it can run in your web browser. It will terminate silently on non-supporting browsers.

把时间冻结 2024-11-11 03:38:16

以下是基于 PhoneGap 加速计 API 构建的 Android JavaScript shake 方法的实现 - github链接

Here's an implementation of a JavaScript shake method for Android built on top of PhoneGap's accelerometer API - github link

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文