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 i开发者_开发百科f this is going to work on android as well.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.
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.
Here's an implementation of a JavaScript shake method for Android built on top of PhoneGap's accelerometer API - github link
精彩评论