Explain what the Device Orientation API does and provide an example of how it could be used.?

What will be an ideal response?


TheDevice Orientation API provides access to data from specialized hardware in many mobile devices for detecting changes in position and speed. A device'sgyroscope detects its orientation in space, and itsaccelerometer detects changes in speed. The Device Orientation API lets your apps react to changes in the data provided by this hardware through the deviceorientationanddevicemotionevents.The deviceorientation event reports a set of coordinates with the property names alpha,beta, andgamma. Each property corresponds to one of the three dimensions, analogous to thex,y, andzaxes used in geometry. By comparing changes in orientation mathematically, your code can respond to user actions including tilting a device. You could use thedeviceorientationevent to create, for instance, a game that simulates a marble on a flat board, with the user tilting the device back and forth and side to side to get the marble into a hole in the center of the board without falling off one of the edges. Based on changes in the orientation of the device, your app would run code changing the direction of the marble's movement.The devicemotion event reports values for acceleration and rotation. You could use this event in an app that provides directions, for instance, to determine if a user is moving or standing still.

Computer Science & Information Technology

You might also like to view...

An array that uses two indices is referred to as a(n) ____________ array.

What will be an ideal response?

Computer Science & Information Technology

____________________ is a technique used to gain unauthorized access to computers, wherein the intruder sends messages whose IP addresses indicate to the recipient that the messages are coming from a trusted host.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Which of the following activities is carried out by the ALU?

A. Moves read/write heads B. Performs arithmetic calculations C. Creates virtual memory D. Renders video images

Computer Science & Information Technology

The stricter syntax rules of HTML5 are consistent with syntax rules of which of the following?

A. CSS B. WYSIWYG C. JSP D. XML

Computer Science & Information Technology