A Glimpse into Windows Phone SDK 8.0

19 sep. 2018
Intermediate
7,76K Views
9 min read  

Windows Phone SDK 8.0 provides a number of new and updated features to window phone developers like as native gaming development, a phone-specific version of the Windows Runtime, and a new kernel. This article helps you to take a quick look at all the new APIs and capabilities in the Windows Phone 8.0 SDK.

Native development

Until now, app developers could only write managed apps and games for Windows Phone. This changes with Windows Phone 8, as developers, can now write native C++ code and access a significant subset of the Windows 8 APIs. Ever wanted to use a native library like SQLite in Windows Phone.

Tiles and notifications

Windows Phone 8 have new three types tile live titles that are accessible by the following classes:

  1. FlipTileData

    This is the regular live tile that we are used to seeing in Windows Phone 7.

  2. IconicTileData

    This is similar to the FlipTile but follows more closely the Windows Phone design principles and displays an icon instead of an image.

  3. CycleTileData

    This can cycle up to 9 images, similar to the Pictures live tile.

Now, Live tiles also has three sizes: small, medium and large. You can control the tiles size in the WMAppManifest.xml file.

Lock Screen

Now, it is possible for apps to display notifications on the lock screen. The information comes from the primary tile and you can enable this feature by editing the WMAppManifest.xml file.

When this functionality is enabled, the user can select to see notifications from your app in the lock screen settings.

New Map

Windows Phone 8 comes with a new Map control that is different from the old Bing Maps control that was available with previous Windows Phone 7.1. The old Bing Maps control is still available in Windows Phone 8, but is it is not recommended that you always use the new Map control.

The new Map control is available through the Microsoft.Phone.Maps, Microsoft.Phone.Maps.Contols, Microsoft.Phone.Maps.Services namespaces.

New Location APIs

The Windows Phone 8 SDK also included new Location APIs that is exposed through the Geolocator class. Now, Continuous location tracking is easy to implement, and you can even track the phone's location in the background. You can even get the current location more efficiently and also improve the battery life using the new GetGeopositionAsync method as shown in the following code snippet:

Geolocator geolocator = new Geolocator();
geolocator.DesiredAccuracyInMeters = 50;
Geoposition position =await geolocator.GetGeopositionAsync(
 maximumAge: TimeSpan.FromMinutes(1), timeout: TimeSpan.FromSeconds(30));

Speech

Launching apps with speech is already available in Windows Phone 7, but now Windows Phone 8 comes with speech commands which allow you to deep link commands to specific pages or actions in your app.

Windows Phone 8 also comes with new speech recognition and text-to-speech APIs which enable developers to easily allow users to interact with their apps using speech.

Here is a sneak peek into the new speech recognition and text-to-speech APIs:

privateasync void btnSpeak_Click(object sender, RoutedEventArgs e)
{
 if (this.speechRecognizer == null)
 {
 this.speechRecognizer = new SpeechRecognizerUI();
 }
 // start recognition with default dictation grammar
 SpeechRecognitionUIResultrecognitionResult = await this.speechRecognizer.RecognizeWithUIAsync();
 // display the speech recognition result
 this.txtRecognitionResult.Text = string.Format("You said: \"{0}\"", recognitionResult.RecognitionResult.Text);
}

privateasync void btnSpeakText_Click(object sender, RoutedEventArgs e)
{
 SpeechSynthesizer synthesizer = new SpeechSynthesizer();
 awaitsynthesizer.SpeakTextAsync(this.tbTextToSpeak.Text);
}

VoIP

Windows Phone 8, you can create Voice over IP (VoIP) apps that allow users to make audio and video calls over their data connection. VoIP apps are integrated into the built-in phone experience so that, for example, incoming calls are displayed using the same phone UI as regular cellular calls.

Windows Phone 8 allows developers to create Voice over IP (VoIP) apps that allow users to make audio and video calls over their data connection. VoIP apps are integrated into the built-in phone experience so that, for example, incoming calls are displayed using the same phone UI as regular cellular calls. To implement a VoIP app that has this level of integration into the platform, several components are required:

  1. Foreground app

    This app is available in the list of apps and can be pinned to the home screen, as any other app

  2. VoipHttpIncomingCallTask

    This is a background agent that handles incoming calls

  3. VoipForegroundLifetimeAgent

    This bootstraps the background process and keeps it alive, so that outgoing calls can be made quickly; launched by the foreground app and runs until the app is in the foreground

  4. VoipCallInProgressAgent

    This is launched when a call is started, signals the app that more CPU cycles have been allocated and it can start processing audio and video data

  5. VoipKeepAliveTask

    This runs periodically and gives the app an opportunity to ping the VoIP service

  6. Windows Phone Runtime assembly

    This implements most of the functionality for connecting and managing VoIP calls; this assembly has access to native APIs for audio and video processing and can also call unmanaged C and C++ libraries that the app might need to use

  7. VoIP cloud service

    This initiates calls by using push notifications

Bluetooth

Bluetooth is a wireless communication technology that devices within a 10-meter proximity can use to communicate with each other. You can use the new Bluetooth API introduced in Windows Phone 8 to create apps that communicate with other phones using Bluetooth technology. Core Bluetooth scenarios for Windows Phone 8 include app-to-app and app-to-device communication and open up a wide range of possibilities you can use to make your app more connected.

Wallet

Windows Phone 8 introduces the Wallet, which app users can use to do the following:

  1. Collect coupons, credit cards, memberships, loyalty cards, and more in one place.

  2. Manage the payment instruments that they use in the app and music store.

  3. Link items in the Wallet to apps on their phone.

  4. Make contact-less transactions, using Near-Field Communication (NFC), in some markets.

The Wallet gives app developers the ability to provide users with a richer experience by integrating with their Wallet items. Using the functionality provided through the Wallet namespace, you can create, read, write, and delete Wallet items from your app. Through the Windows Phone 8 Wallet experience, you can keep items up-to-date by using agents, and interact with the user with status messages and custom fields.

The Wallet integration is additional functionality that allows you to better reach customers by being able to engage with them on an additional new surface area.

Multi Resolution

Windows Phone 8 supports WVGA, WXGA, and 720p devices. The following table lists the new resolutions. All of these resolutions are supported in Windows Phone 8 Emulator.

Windows 8 Multi Resolution
Devices
Resolution
Aspect ratio
Scaled resolution
WVGA
480 × 800
15:9
480 × 800
WXGA
768 × 1280
15:9
480 × 800
720p
720 × 1280
16:9
480 × 853

Direct3D and games

In addition to native development, Direct3D is also added to the Windows Phone 8. This means that a Direct3D-based PC game can share much of its code base with a phone version, and developers can use state-of-the-art middleware tools and engines that power the industry’s biggest game titles to develop games for Windows Phone.

Direct3D app refers to apps that are written entirely in native code, and which use only Direct3D for their UI. This type of app uses a completely different app model than managed apps, and can’t use many of the features of managed apps, such as Live Tiles and push notifications.

App Model

Windows Phone 8 supports following app models by using which you can develop your window phone app.

XAML

XAML is a declarative language that you can use to create UI elements, such as controls, shapes, and text. You can develop your XAML apps using C#/VB. XAML apps can reuse C++ code by including it in a Windows Runtime Component. New project templates allow you to incorporate Direct3D graphics into XAML apps.

Direct3D

Direct3D app development is an attractive choice for developers who want the graphics capabilities of Direct3D. It is primarily used by C++ developers to build games that require high performance.

HTML

HTML-based phone apps aren’t a supported app model in Windows Phone 8. However, a developer can create a managed app with a XAML front end that uses an embedded browser control to display local HTML content, and it’s possible to access phone APIs by using the InvokeScript method and ScriptNotify events.

New Camera APIs

Windows Phone 8 brings many new features and extensibility points related to camera and pictures. Developers can now create custom lenses that integrate with the built-in camera app. Working with photos is even easier with the new GetPreviewImage and GetPath extension methods on the Picture class and the new ShareMediaTask launcher:

private void btnLaunchShareMediaTask_Click(object sender, RoutedEventArgs e)
{
 PhotoChooserTask photoChooserTask = new PhotoChooserTask();
 photoChooserTask.ShowCamera = true;
 photoChooserTask.Completed += photoChooserTask_Completed;
 photoChooserTask.Show();
}
 
voidphotoChooserTask_Completed(object sender, PhotoResult e)
{
 ShareMediaTask shareMediaTask = new ShareMediaTask();
 shareMediaTask.FilePath = e.OriginalFileName;
 shareMediaTask.Show();
}

In Windows Phone 7 you could integrate your app in the Photos Hub and the Share picker, and now, with Windows Phone 8, you can also integrate your app in the Photo viewer and the Photo edit picker.

New Media Library APIs

Windows Phone 8 also allows developers to add and remove music files from the user's media collection, using the SaveSong and Delete methods accessible from the MediaLibrary class. There are also improvements for background audio.

Localization and Globalization

In Windows Phone 8 you can create apps that read from right to left, and apps that use bidirectional languages.

What do you think?

I hope you will enjoy the tips while developing your windows phone apps. I would like to have feedback from my blog readers. Your valuable feedback, question, or comments about this article are always welcome.

Share Article
About Author
Shailendra Chauhan (Microsoft MVP, Founder & CEO at Scholarhat by DotNetTricks)

Shailendra Chauhan is the Founder and CEO at ScholarHat by DotNetTricks which is a brand when it comes to e-Learning. He provides training and consultation over an array of technologies like Cloud, .NET, Angular, React, Node, Microservices, Containers and Mobile Apps development. He has been awarded Microsoft MVP 8th time in a row (2016-2023). He has changed many lives with his writings and unique training programs. He has a number of most sought-after books to his name which has helped job aspirants in cracking tough interviews with ease.
Learn to Crack Your Technical Interview

Accept cookies & close this