HTML and CSS Reference
In-Depth Information
Chapter 12
Accessing devices and
sensors
If you are interested, you never have to look for new interests. They come to you.
When you are genuinely interested in one thing, it will always lead to something else.
— Eleanor Roosevelt
Smartphones and tablets owe much of their success to the high quality of their sensors and internal
devices. If you go back to the early days of the iPhone, you may recall how astonished people were
with the now-mundane Flashlight application. That was essentially a toy app—though it had some
practical use. The assortment of devices and sensors you find on modern devices, such as a tablet
equipped with Microsoft Windows 8, is so rich as to enable developers to think and build completely
new types of applications.
As a Windows 8 developer you have access, even from a JavaScript-based programming
environment, to a variety of Windows Runtime application programming interfaces (APIs) that give
you control of a range of sensors, including such things as a GPS, a light sensor, an accelerometer, and
a compass. In addition, a Windows Store application can gain access to devices both connected to the
computer or embedded in it. Typical examples are printers and the webcam.
In this chapter, you'll learn how to use the webcam programmatically, how to print content, and
how to work with one of the most useful sensors—the GPS component that returns the current
location of the user.
Working with the webcam
Today almost all computers and devices come with a high-resolution webcam. A webcam is typically
employed by built-in programs to support video conferencing and video chat. It is also common
for applications to leverage the webcam to take instant pictures of the user. From a programming
perspective, the webcam is just like any other piece of hardware. As a developer, you learn about
Search WWH ::




Custom Search