Mobile Corner
A Lap Around the Windows Phone 8 Platform
Nick Randolph dissects Windows Phone 8 as a platform for application and enterprise developers.
- By Nick Randolph
- 01/04/2013
Windows Phone 8 complements Microsoft Office to deliver a highly productive business tool. The core platform delivers an integrated experience across all of its built-in applications, with almost seamless integration now available to third party applications. Devices and applications can be deployed and managed by enterprises. I’ll discuss some of the features that make Windows Phone a compelling choice for enterprise and application developers.
One of the most distinguishing features of the Windows 8 platform is Live Tiles. Introduced back in 2010 with the release of Windows Phone, the concept of tiles that represent more than simply a link to an application is one that now permeates across Windows Phone, Windows 8 and even Xbox. Rather than users having to launch an application to check for updates, Live Tiles enable the application to expose relevant information via the Start screen. Other platforms allow for simple notification mechanisms--the number of unread or unprocessed items--via an actual notification dialog to alert the user. Live Tiles give applications a much richer interface to expose this information, with the ability to customize image and content attributes.
The transition from Windows Phone 7 to Windows Phone 8 includes a number of seemingly minor changes to the Start screen. There's no longer a wider gutter on the right; tiles can be small, medium or wide; and the applications list arrow is now at the bottom of the Start screen. However, the cumulative effect is that the Start screen is richer, more personalized and unique to every Windows Phone user.
Application developers can now take advantage of all three tile sizes, whereas previously the wide tile format was reserved for specific applications. You can choose from Iconic, Cyclic and Flip tile templates, to tailor Live Tiles to match your application's content and style. Figure 1 illustrates the Flip and Iconic tile templates.
[Click on image for larger view.] |
Figure 1. The Flip and Iconic Windows Phone 8 tile templates. |
Live Tiles really become interesting when they're used to link directly into a specific part of an application (often referred to as a deep link). For example, in the Qantas application for Windows Phone, users have the ability to pin individual flights to the start screen. A tile representing a flight is updated independently to reflect the current status of that flight. Tapping the tile launches the Qantas application directly into the flight details page, making it easy to find relevant flight information, including the boarding pass. In an enterprise setting, different Live Tiles might represent different aspects of the business, allowing users to add relevant tiles to their Start screen to form a personalized dashboard of information.
Updating Lock Screen Attributes
In addition to customizing the Start screen, users now have more control over the lock screen of their phone. While the layout of the lock screen hasn’t changed significantly, application developers can now update the background image, notification text and notification icon/count. For all three lock screen attributes, an application has to register the appropriate extension in the manifest file. In order to update the background of the lock screen, an application has to request to be the lock screen provider. As the lock screen provider, an application can update the background image as frequently as it likes, assuming the application is running, or periodically from a background agent. In the lock screen area of settings, the user can specify which application is responsible for setting the notification text and which five application icons will appear on the lock screen. To update the notification text, an application needs to set the BackContent property of the primary or application tile. Similarly, the count that appears next to the icon on the lock screen matches the count on the primary tile. The following code illustrates how an application requests to be the lock screen provider and how it can update the background image, notification text and count.
if (!LockScreenManager.IsProvidedByCurrentApplication)
{
await LockScreenManager.RequestAccessAsync();
}
if (LockScreenManager.IsProvidedByCurrentApplication)
{
var localfile = "/shared/shellcontent/customlockscreenimage.jpg";
var imageUri = new Uri("ms-appdata:///local" + localfile, UriKind.RelativeOrAbsolute);
LockScreen.SetImageUri(imageUri);
var notificationData = new StandardTileData
{
BackContent = "notification text for lockscreen",
Count = 15
};
ShellTile.ActiveTiles.First().Update(notificationData);
}
Mapping Data with Nokia
Windows Phone has been criticized in the past for its mapping support. While the built-in mapping experience was adequate, the Bing maps control made it hard for developers to build applications that performed well. Windows Phone 8 now uses Nokia’s maps for the built-in mapping experience and this functionality is available to developers via a new map control. This control is vector based, making it incredibly fast. It has four different cartographic modes, light and dark color modes (shown in Figure 2) and can display landmark and pedestrian information. In addition to the improved mapping capability, Windows Phone 8 allows for true background location tracking. This means that an application that wishes to track location can do so without being run as the foreground application.
[Click on image for larger view.] |
Figure 2. Modes of the new map control. |
Windows Phone 8 also allows for mapping data to be downloaded and cached for offline usage. Applications that rely heavily on mapping data can prompt the user to download, and subsequently update, the appropriate mapping data. This is done using the new MapDownloaderTask and MapUpdaterTask launchers. Other new launchers include the SaveAppointmentTask and ShareMediaTask, for creating an appointment and sharing images/video respectively.
Application developers can now take advantage of the full power of the built-in speech capabilities with the ability to launch and control applications using voice commands. Furthermore, developers can use speech recognition to facilitate voice input and text-to-speech to read out application text or data.
Smartphones are increasingly viewed as an alternative to carrying cash, credit and debit cards. Windows Phone 8 includes a digital Wallet where credit and debit cards can be added. However, the Wallet isn’t restricted to just monetary based cards, it can be used to represent any membership or loyalty system. Consider including an entry in the Wallet for any application that includes a membership or user profile, as it provides yet another entry point into the application.
Improving App Performance
One of the hardest challenges for developers is making their applications perform well. Windows Phone 8 now includes both the Panorama and Pivot controls in ROM, making them much faster. In addition, the LongListSelector has been included in the SDK, rather than as a separate download in the Toolkit for Windows Phone. (The toolkit still exists and is where other Windows Phone specific controls can be found). A significant amount of work has gone into this control to make it perform extremely fast, so much so, that it's now recommended for developers to use this control in favor of the ListBox.
On the subject of performance, the Windows Phone 8 SDK makes it much easier to build applications that function and perform well. The emulator technology has changed to leverage Microsoft’s investment in Hyper-V, which means the emulator more closely resembles a real device (it no longer piggybacks on the host computers network connection). It also makes it possible to simulate different network conditions via the new Simulation Dashboard, shown in Figure 3. The performance analysis tool, which shipped in the previous version of the SDK, has been renamed to the Windows Phone Application Analysis. It’s been extended to provide metrics on battery consumption, network and CPU usage.
[Click on image for larger view.] |
Figure 3. The Windows Phone 8 Simulation Dashboard. |
Advances in Hardware Specifications
Some of the most significant advances in Windows Phone 8 have been in the supported hardware. The original Windows Phone supported a single resolution of 480x800 (WVGA). There are now two higher resolution options: 1280x768 (WXGA) and 1280x720 (720p). Both WVGA and WXGA are 15:9 aspect ratio, while 720p is 16:9. As the platform automatically scales the layout, developers still only really need to target a single width of 480, allowing for additional vertical space for when the application is run on the 720p based devices. It’s worth noting here that applications built for the previous version of Windows Phone will continue to run on all Windows Phone 8 devices. However, on the 720p devices there will be extra vertical space added to pad out the remaining vertical space. This is to ensure compatibility for applications that were only designed for WVGA.
While near-field communication (NFC) in mainstream use is just beginning, this set of communication standards is becoming increasingly important as businesses start to use NFC to innovate around their traditional workflows. Most developers start off thinking about NFC in the context of payments, because this is where most of us have seen it being used. However, if it's used to launch or update a workflow, there are countless other scenarios. Windows Phone 8 support for NFC includes the ability to read and write. Of course, it's up to the hardware manufacturer as to whether a specific phone will support NFC. The Windows Phone 8 implementation of NFC also allows it to be used to establish device-to-device data connections via either Bluetooth or WiFi, opening up a raft of peer-to-peer style application scenarios. Developers can now connect to any paired Bluetooth device to read or write data to an external peripheral.
Most Windows Phone 8 devices come with quite a bit of internal storage. Some devices will support an SD card for users who need more storage for photos, videos and music. The SD card can be used to distribute applications and content for third party applications, but it cannot be used to store documents or email data because it cannot be encrypted. Developers also face some limitations. You can only read file types that you have associated with and you can't write to the SD card.
Following the acquisition of Skype, Microsoft made a deliberate decision not to include it as part of the core Windows Phone experience. Instead, the company worked to establish a set of APIs that would allow any third party VoIP provider to build an application that integrates into the built-in call and dialer experience. Of course, Skype is the first example on Windows Phone but Microsoft has announced a new version of its Lync client application that will make use of these APIs.
For quite some time, developers have requested a mechanism for passing data between applications, or even simply launching another application. Windows Phone 8 supports the ability for applications to register file type and/or protocol associations. Passing data between applications can be done either by launching a file with the appropriate file extension, or by launching a Uri that begins with the appropriate protocol. This functionality has to be used with care as there is nothing to prevent multiple applications from registering for the same file type and protocols.
Prior to Windows Phone 8, developers were limited to either selling their applications, or placing advertising within them. (They could also use a third party payment engine but most didn’t). The Windows Phone Store now supports registering both durable (single purchase) and consumable (multiple purchase) products that can be bought from within an application. This allows developers to determine the optimum way to charge for their applications, while still encouraging new users to download their applications. One such strategy is to make the application free and then to use an in-app purchase to continue using the application after the initial free period, or for an in-app purchase to provide more features.
Enterprise-Level Features
Most people don’t realize that Windows Mobile 6.5 was ahead of the curve when it came to device management within an organization. However, with the change to a consumer brand, Windows Phone was initially missing some of those core requirements, until now. Windows Phone 8 builds on the existing set of supported Exchange ActiveSync policies, adding support for more policies and the ability to do true device management via a mobile device management (MDM) system. One of the core mantras of the Windows Phone platform is that of consistency, rather than a different experience from each of the MDM vendors. Windows Phone 8 provides a consistent enrollment experience, which includes the provisioning of certificates, policies and application management, as shown in Figure 4.
[Click on image for larger view.] |
Figure 4. Windows Phone 8 provides consistent Mobile Device Management enrollment. |
Another important enterprise requirement is the need for both device and application encryption. At a device level, Windows Phone 8 uses a bitlocker-like technology to encrypt the device contents. Applications downloaded from the Windows Phone Store are now encrypted so that they can’t be readily decompiled. The Windows Phone Store also NGEN’s (compiles to native) applications to improve startup and runtime performance.
I've covered a number of the new and exciting features of Windows Phone 8. As with all platforms, there are limitations and restrictions that may make it hard to build certain applications. However, the core feature set of Windows Phone 8 coupled with the comprehensive development and design tools, makes it one of the most innovative platforms to build applications on. You can build a prototype in hours and get your idea to market in significantly less time than apps for other smartphone platforms.
About the Author
Nick Randolph runs Built to Roam, a consulting company that specializes in training, mentoring and assisting other companies build mobile applications. With a heritage in rich client applications for both the desktop and a variety of mobile platforms, Nick currently presents, writes and educates on the Windows Phone platform.