HTML and CSS Reference
In-Depth Information
Note Since WinJS applications are essentially browser-based applications, you may think
that you can print the old JavaScript way: by calling the window.print method. That works,
but it is viable only in very simple situations. It is recommended that you use the window.
print method only if you have a single printing template. After you invoke window.print you
have no further control over the process and can't update or customize the content being
printed.
Working with the GPS system
To round off this chapter, this section shows how you can obtain information about the user's current
position. Getting to know the exact (or even approximate) user location is an incredibly valuable piece
of information, because it enables you to tailor specific services and information for that user.
Detecting latitude and longitude
Windows 8 devices are equipped with a GPS device that you can query for basic location information,
such as its latitude and longitude. Access to the device is wrapped up nicely in an easy-to-use API.
Setting up the project
To get started, you create a new project and follow all the steps as in previous exercises. The user
interface can be as simple as in Figure 12-13: just a button and some text elements that display
latitude and longitude.
FIGURE 12-13 The main user interface of the geolocation sample application.
The most important step in setting up the project is to add the Location capability in the
application manifest. Open the manifest file in the project, select the Capabilities tab, and check
Location, as shown in Figure 12-14.
Search WWH ::




Custom Search