Extension SDKs in Universal Windows Platforms

Introduction

Well, Windows Universal now has Extension SDKs unique to specific target devices like Mobile, PC, IoTs, Xbox and so on.

Existing SDKs in Windows 10

For Windows 8 two binaries, for Windows and Windows Phone, are generated with a shared project and we can code based on a condition, a compilation constant, that we can also switch for either Windows or Windows Phone at design time and it automatically refers to the respective ADKs whenever the context switches, of course using Intellisense.


Figure 1 Windows Binary

DKs in UWP

Here in Windows 10 a Universal Windows Platform App will not have two binaries, that is the great logic behind the UWP Extension SDKs. So a single binary that can play multiple roles based on the targeted device that is about to deploy. Because here the binary just targets the UAP that is unified across all devices.


Figure 2 DKs in UWP

For example, you can see the Reference Manager under UAP -> Extensions. You can find the applicable SDKs as follows (by default).

  • Windows.Desktop.
  • Windows.Mobile.
  • Windows.Xbox.

Using the preceding SDKs you can code your app like to access a specific external device related to a specific targeted device. Such external device, like a Scanner, Remote Control, Hardware Button and so on. So creating a Universal Windows Platform using the Extension SDKs, you can run the app in the desktop with the desktop related APIs and you can also play the app in Xbox by accessing all the required controls in the device. Similarly you can get and access all the internal hardware control that is present in the Phone. Well the following image can convey to you better about the UWP extension SDKs.


Figure 3 Windows Core

Also using Conditional Compilation there is no need to check the targeted device but contracts, for example “Windows.Foundation.Metadata.ApiInformation” that contains the following interfaces.

  1. sApiContractPresent.
  2. IsEnumNameValuePresent.
  3. IsEventPresent.
  4. IsMethodPresent.
  5. IsPropertyPresent.
  6. IsTypePresent.
  7. IsWritablePropertyPresent.

If you need to code anything that depends upon the back button on the phone, you need to access the hardware button of the phone that is typically not available with other devices like the desktop so you can check the availability of the HardwareButton using the following code:

  1. if(Windows.Foundation.Metadata.ApiInformation.IsTypePresent(“Windows.Phone.UI.Input.HardwareButtons”))    
  2. {    
  3.    Windows.Phone.UI.Input.HardwareButtons.BackPressed += this.HardwareButtons.BackPressed;    
  4. }  
Also the available contracts are as follows (Preview).
  • Windows.Foundation.FoundationContract.
  • Windows.Foundation.UniversalApiContract.
  • Windows.Foundation.RemoveFromThisBadContract.

Up Next
    Ebook Download
    View all
    Learn
    View all