What you need:
– Basic knowledge in HTML and CSS.
– A Mac and Xcode (no programming skills required) for exporting the app.

Using the accelerometer

With iOS version 4.2 and newer it is now possible to read accelerometer and gyroscope data via javascript. Here’s an example, what could be done with it: http://isthisanearthquake.com/

To read the data from the accelerometer use the following javascript event:

window.ondevicemotion = function(event) {
// event.accelerationIncludingGravity.x
// event.accelerationIncludingGravity.y
// event.accelerationIncludingGravity.z
}

If you want to read the data from the gyroscope (iPhone 4, iPod Touch 4G+ and iPad 2 only):

window.ondeviceorientation = function(event) {
// event.alpha
// event.beta
// event.gamma
}

For more information visit: http://www.mobilexweb.com/blog/safari-ios-accelerometer-websockets-html5

Shake Event

If you need to create a shake event (for example to fetch some data when shaking the device) take a look at http://www.jeffreyharrell.com/blog/2010/11/creating-a-shake-event-in-mobile-safari/

Laker is now on github! Please discuss issues, suggestions or tipps in the github forums of Laker. Thanks! ;)

Leave a comment, suggestion or question.

You must be logged in to post a comment.