Chapter 2. Using Location in Windows Phone 7.5

Having looked at location-based services (LBS) and after getting a quick look at Microsoft's Location Service in Chapter 1, The Location-based World, we will now explore the Microsoft Location Service in abundant detail in this chapter, as well as build a simple "Hello Location" app for our Windows Phone, modeled after the "Hello World" paradigm!

This chapter covers:

  • Introduction to Windows Phone 7.5
  • Overview of Windows Phone Location Service
  • Starting and using the Location Service
  • Building a Hello Location application
  • Working with the Windows Phone location simulator

Introduction to Windows Phone 7.5

Windows Phone 7.5 (codenamed Mango) is a visually appealing upgrade to Windows Phone 7, and a complete rewrite-from-scratch for the ageing Windows Mobile 6.5 (remember the phones with the Start menu!). With iPhone and Android ushering in a new era of smartphones focusing on simplicity and user interface, Microsoft was a bit late in the game with its offerings. However, the launch of Windows Phone 7.5 (internal version 7.1) saw Microsoft coming back into the arena with a refreshing new UI, tighter integration with Office, social hub, Xbox LIVE, and a bag full of other goodies.

Apps can be downloaded from the integrated Windows Phone Marketplace. The home screen is different as well; you are no longer thrown with tons of app icons on it, instead the home screen on the Windows Phone is an iconic grid of Tiles (that can be customized). Each of these Tiles can be updated in real time, so there is no need to manually open an application and update them. For example, think of a photo tile that updates itself whenever there is a new photo available from the user's subscribed channels. More on Tiles soon; to get a feel of the home screen, see the following screenshot:

Introduction to Windows Phone 7.5

Microsoft's partnership with the mobile industry goliath Nokia saw the emergence of great smartphones powered by Nokia's excellent hardware coupled with Microsoft's decades of knowledge and research in software, particularly Windows.

The current Nokia WP7.5 handset models are listed as follows:

  • Nokia Lumia 800 (We use this device as the test device for our examples and apps in the book)
  • Nokia Lumia 710 (A trimmed version of Lumia 800)
  • Nokia Lumia 900
  • Nokia Lumia 610 (Entry-level WP7.5 Phone)

Let us now look at some of the key functionality in Windows Phone 7.5 Mango:

  • Live Tiles
  • Panorama control
  • Pivot control
  • App Connect

Live Tiles

Live Tiles are Microsoft's killer feature, which clearly differentiates it from the iPhones and the Androids. Live Tiles allow you to pin applications to the home screen for live updates. Any application apart from the default phone dialer, e-mail, and messaging can use the Live Tiles functionality to allow for live updates when the application is pinned to the home screen.

Technically Tiles are 37x37 pixel components that includes the application title, background image, icon, and a count. You can also have a double-sided tile! Tiles can be updated in two different ways: via the application logic and via push notifications through the Microsoft Notification Service.

Panorama control

Panorama-based applications offer a unique view of content by providing a long horizontal canvas to the app. The user can scroll back and forth between the screens easily. The idea of a panorama app is to give the users a sneak peak of the next/previous screens thereby leading to more content view.

The next screenshot depicts an example of a panorama-based application including a background image scaled horizontally to fit each screen differently, thus giving a pleasant experience when using the app.

Panorama control

Pivot control

Pivot-based applications are similar to panorama controls, except for the fact that a pivot takes up the full screen and can handle a large number of pivot items (Microsoft recommends only up to four screens for panorama control). Unlike the panorama control, pivots do not show a preview of the next screen. The search on the Windows Phone 7.5 devices uses the pivot control, as shown in the following screenshot:

Pivot control

App Connect

App Connect is a new way of discovering apps (apart from the Windows Marketplace), via the search experience on the phone. With App Connect, users can launch an application directly from the Bing search results display. This makes it easier for users to search the data and find apps that can use that data. For example, if you are searching for foursquare on your Windows Phone, you will get the first result as the app itself. See the following screenshot:

App Connect

Tools for Windows Phone 7.5 developers

The Windows Phone SDK 7.1 (the SDK version is 7.1 while the marketed version is 7.5) available for download at http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27570 includes the following tools to get you started with building apps for Windows Phone:

  • Visual Studio 2010 Express for Windows Phone
  • Microsoft Expression Blend 4 for Windows Phone
  • XAML

Download the vm_web2.exe file as shown in the following screenshot and double-click on it to start the installation:

Tools for Windows Phone 7.5 developers

Accept the License Agreement as shown in the following screenshot:

Tools for Windows Phone 7.5 developers

Next select the Install Now button to continue with the default installation profile as shown in the next screenshot. This method of installation should be fine for most use cases.

Tools for Windows Phone 7.5 developers

Continue to download the files and finish the installation. Once the installation is over, you should see Visual Studio 2010 Express for Windows Phone and Microsoft Expression Blend 4 installed in the Start menu.

Visual Studio 2010 Express for Windows Phone

Visual Studio 2010 Express for Windows Phone provides all the tools required to build your Windows Phone applications. From Silverlight applications to XNA-based games, you can build multiple types of applications using the same IDE. The bundled Windows Phone Emulator helps you test your applications before submitting to the Marketplace. Application developers can work with C# or VB.NET to code their applications. The following screenshot shows what the main window of the studio looks:

Visual Studio 2010 Express for Windows Phone

It is a good idea to register the product as soon as you are done with the installation.

Microsoft Expression Blend 4 for Windows Phone

The Windows Phone 7.1 SDK also includes a design tool called Expression Blend (version 4) that allows for designing Windows Phone applications. Think it of as Photoshop for Windows Phone developers! However Expression Blend works with the full project solution, so you can design your applications and run the app in the emulator right within Expression Blend.

XAML

Windows Phone app development using Silverlight involves the use of the Extensible Application Markup Language (XAML). XAML has an XML-based structure for defining the look and feel for Silverlight-based applications. XAML controls in Silverlight communicate with our code (C# or VB.NET) via the control properties.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.122.195