views:

37

answers:

0

I have found a way of finding out the orientation of the device (portrait, landscape left, landscape right, upside down) via the listener

 <body onorientationchange="updateOrientation();">

and in the header

function updateOrientation() {

        switch(window.orientation) {
                case 0:
                    // normal
                    // do some cool things...
                    break;

                case -90:
                    // right
                    // do some cool things...
                    break;

                case 90:
                    // left
                    // do some cool things...
                    break;

                case 180:
                    // upside down
                    // do some cool things...
                    break;
        }
}

but is it actually possible to find out the X/Y/Z values of the accelerometer in general?