windows binary phone binary windows universal desktop pc 2 in 1 mobile tablet phablet phone xbox iot...
TRANSCRIPT
![Page 1: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/1.jpg)
Adaptive CodeDeveloper’s Guide to Windows 10
![Page 2: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/2.jpg)
AgendaCompilation ConditionalsPlatform Extension SDKsAdaptive CodeAdaptive Code and API VersionsDeclaring limitations on where your app can run
![Page 3: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/3.jpg)
What are Adaptive Apps?Windows apps adapt to different versions of the platformWindows apps adapt to different types of devicesWindows apps adapt to different screen sizes
Adaptive UI handles different screensAdaptive Code can "light up" your app to conditionally execute code only when running on specific device families and/or particular versions of platform/extension APIs• Conditionally take advantage of unique device capabilities• Use newer APIs while still supporting down-level clients
![Page 4: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/4.jpg)
Compilation Conditionals
![Page 5: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/5.jpg)
Windows 8.1 Universal: Shared code, two binaries
WindowsBinary Phone
Binary
![Page 6: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/6.jpg)
Not all APIs were available everywhere
![Page 7: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/7.jpg)
C# Syntax
#if WINDOWS_PHONE_APP Windows.Phone.UI.Input.HardwareButtons
.BackPressed += this.HardwareButtons_BackPressed;#endif
C++ Syntax
#if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP_backPressedEventToken = HardwareButtons::BackPressed += ref new EventHandler
<BackPressedEventArgs^> (this, &NavigationHelper::HardwareButton_BackPressed);
#endif
Compilation directives
![Page 8: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/8.jpg)
Adaptive code in UWP:Introducing Platform Extension SDKs
![Page 9: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/9.jpg)
Windows universal
DesktopPC
2 in 1
Mobile
Tablet
Phablet
Phone
Xbox
Xbox
IoT
Band
IoT headless
Raspberry Pi
Home Automatio
n
Surface Hub
Surface Hub
Holographic
HoloLens
![Page 10: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/10.jpg)
Universal Windows PlatformA single API surfaceA guaranteed API surfaceThe same on all devices
PhoneDevice
XboxDevice
DesktopDevice
Windows Core
Universal Windows Platform
![Page 11: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/11.jpg)
Many UWP apps will not need to use any device family-specific APIs, but for those that do, we have Platform extension SDKs
![Page 12: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/12.jpg)
Platform extensionsDevice-specific APIFamily-specific capabilitiesCompatible across devicesUnique update cadence
PhoneDevice
XboxDevice
DesktopDevice
Windows Core
Universal Windows Platform
Windows App
Phoneextension
Xboxextension
Desktop
extension
![Page 13: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/13.jpg)
Platform extensions don't invalidate binaries on other devices
![Page 14: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/14.jpg)
IsApiContractPresentIsEnumNamedValuePresentIsEventPresentIsMethodPresentIsPropertyPresentIsReadOnlyPropertyPresentIsTypePresentIsWriteablePropertyPresent
Testing for capabilities
Windows.Foundation.Metadata.ApiInformation
![Page 15: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/15.jpg)
Test capabilities at runtime
var api = "Windows.Phone.UI.Input.HardwareButtons";if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent(api)){
Windows.Phone.UI.Input.HardwareButtons.CameraPressed += CameraButtonPressed;}
![Page 16: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/16.jpg)
The ApiInformation API tests for availability of a type or contract at runtime
![Page 17: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/17.jpg)
PlatformSpecific.Analyzer NuGet package
![Page 18: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/18.jpg)
Identifying the Extension SDKMSDN docs:
![Page 19: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/19.jpg)
Exploring API Contracts
![Page 20: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/20.jpg)
Demo: Api Information
![Page 21: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/21.jpg)
Adaptive Code used to call specific API versions
![Page 22: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/22.jpg)
Using Specific Versions of an APIAdaptive code techniques can also be used for handling different revisions of an APIYou write your app against a UWP version, but ‘n’ months later, UWP v.Next ships to users machinesApplies to Extension SDKs and Packages as well – new versions may offer new functionality
You want to keep supporting customers who haven’t updated yet, but take advantage of up-level APIs for those who have
![Page 23: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/23.jpg)
Gate use of up-level APIsvar contract = "Devices.Scanners.ScannerDeviceContract";int majorVersionRequired = 3;
if (Windows.Foundation.Metadata.ApiInformation. IsApiContractPresent(contract, majorVersionRequired )){
// Call the API that is present in V3 and above ...}else{ // Your original code supporting users who haven’t upgraded yet ...}
![Page 24: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/24.jpg)
Declaring limitations on where your app can run
![Page 25: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/25.jpg)
Declare Device Family DependenciesRuns on all UWP device families:<Dependencies> <TargetDeviceFamily Name="Windows.Universal" minVersion="10.0.10240.0" maxVersionTested="10.5.0.0" /></Dependencies>
Runs on all UWP, but limitations apply to Desktop:<Dependencies> <TargetDeviceFamily Name="Windows.Desktop" minVersion="10.2.0.0" maxVersionTested="10.4.0.0" /> <TargetDeviceFamily Name="Windows.Universal" minVersion="10.0.10240.0" maxVersionTested="10.5.0.0" /></Dependencies>
Runs only on Mobile device family:<Dependencies> <TargetDeviceFamily Name="Windows.Mobile" minVersion="10.1.0.0" maxVersionTested="10.2.0.0" /></Dependencies>
![Page 26: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/26.jpg)
Package Dependency
<Dependencies>
<PackageDependency
Name="Microsoft.WinJS 1.0"
Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US"
minVersion ="1.5.0.0" />
</Dependencies>
![Page 27: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/27.jpg)
ReviewCompiler ConditionalsPlatform Extension SDKsAdaptive CodeAdaptive Code and API VersionsDeclaring limitations on where your app can run
![Page 28: Windows Binary Phone Binary Windows universal Desktop PC 2 in 1 Mobile Tablet Phablet Phone Xbox IoT Band IoT headless Raspberry Pi Home](https://reader030.vdocuments.mx/reader030/viewer/2022032709/56649eb15503460f94bb71cf/html5/thumbnails/28.jpg)
© 2015 Microsoft Corporation. All rights reserved.