Is it possible to listen for an iPhone (or any mobile phone with accelerometer) shake event with JavaScript? You know like shaking the iPhone to shuffle the next song in iTunes I want to call a JS function on my website when the iPhone got shaken.
In the latest iOS update (4.2) the accelorometer is now accessible from Javascript.
See: http://www.mobilexweb.com/blog/safari-ios-accelerometer-websockets-html5
Here's an elegant implementation of shake detection using the accelerometer if anyone is looking for it:
https://github.com/alexgibson/shake.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With