At Build 2014 the world was introduced to the idea of creating Universal Windows apps. This technology will allow developers to extend platform commonality across multiple Windows devices from one shared project.
In this session I will demonstrate what you will need to know to get going quickly on building one application for both Windows Phone 8.1 and Windows 8.1 OS. We will also see how to extend your project to include other new features.
This talk was given at ConFoo 2015.
2. What is it?
Build one app that targets Windows and Windows Phone
Provides a common experience, shared app identity, single app
purchase, shared in-app purchases and shared data/profile
It is not:
A single binary
A non-Windows application (i.e. Supporting Android & iOS)
A non-native HTML/JavaScript application (i.e. Apache Cordova)
3. Overview
Announced in April 2014
Develop once for all Windows devices using a unified
Windows runtime and set of tools
Project structure comes from Linked Files, a technology since
the early days of .NET 2005
4. Platform Convergence
Windows Phone 8.1, Windows 8 RT and Window 8.1 flavours of
Windows share a common runtime
Existing Windows 8 apps can be migrated to shared projects
Share code while just making tweaks to the UI
Silverlight Phone 8.0 apps work on 8.1 without upgrade
The Windows Runtime API & Microsoft SDKs are
around 90% converged and closing
5. Why should you care?
Windows 10 is coming with a free upgrade for Windows 8 so
exponentially more adoption within the enterprise
Source: OS Platform Statistics, http://www.w3schools.com/browsers/browsers_os.asp
Flip side though is Windows Phone market share is 2.9%
compared to ~84% for Android and ~12% for iOS
Source: Smartphone OS Market Share, Q3 2014, http://www.idc.com/prodserv/smartphone-os-market-share.jsp
6. Things to know
Multiple languages supported (C# or C++ with XAML,
C++ with DirectX, and JavaScript with HTML/CSS)
The IDE is free
Must be Visual Studio 2013 with Update 2 or later
Works with the Express versions and the new Community Edition
Physical device nice to have but not essential
Requires a developer license for your computer
Needs a Microsoft account (i.e. Windows Live account)
Requires a developer account to publish ($20 CAD)
8. How to share code?
Before UA there were:
Linked Files
Portable Class Libraries
We now have:
Shared Projects (Conditional Compilation)
Partial Classes (Split the code across multiple files)
Portable Class Libraries
Base Classes
User Controls
Visibility
9. Things to share
Reusable business logic (C# code)
Resources & Assets (images)
Views similar to both projects:
Login Page
Privacy Page
11. Rules of Thumb
Conditional Compilation
Can make code difficult to read
Solves small, quick-hit platform problems
Only supported when using the Shared project
Partial classes
Makes it easy to isolate platform code
Difficult to see the entirety of your code
Don’t expect to save time writing XAML
Do expect to save time writing implementation code
12. Tips for design
Think through the design for both platforms before you
start coding
If you keep the Microsoft design, it means that the user
knows how to move around the app intuitively
Device variability: Default for tablet Is landscape and
default for phone is portrait
It’s okay if each version doesn’t look the same and
doesn’t have the same features
There is no silver bullet solution
There are just small choices you will make as you develop a
pattern of practice
13. Tips for development
Develop apps in sync to solve problems in parallel
Target lowest supported device for phone development
~50% of Windows Phone users use a low-end device
Startup both projects in the emulator at the same time
Use the Navigation Bar to segment your code per project
Optimize the user experience for the device they are on
14. Testing
Unit Tests
Create separate unit test projects for each platform
Coded UI
Need Visual Studio Premium and Ultimate
Windows App Certification Kit (WACK)
Available as separate download
Windows Store app test cases
15. Publishing
Reserve a name in the store for your app
Valid for 12 months
Must match the Display Name in your app manifest
If the app connects to internet, must have a Privacy Policy
Publish first app and then associate the second to it
Approval takes anywhere from 0.5 days to a week
16. Resources
Get started with Universal Windows Apps:
http://bit.ly/1L45n62
http://bit.ly/1MrKx3Q
http://bit.ly/1u033XM
17. Summary
Please fill out your surveys!
Title: An Introduction to Universal Windows Apps
https://joind.in/talk/view/13288
Contact Details:
@KenCenerelli
Ken_Cenerelli@Outlook.com
kencenerelli.wordpress.com/contact
Editor's Notes
- 100% will probably never happen; different devices and different expectations; e.g. Phone calls but not on tablet
Windows 10 is in Technical Preview now and scheduled for mid-2015
Can create a Mixed app to move existing code towards a universal model
Add a Windows app 8.1
Add a Class Library (Portable for Universal Apps)
Right click PCL | Properties | Change to change targets
Linked Files:
Linked Files and Shared Projects are pretty much the same
Universal Apps use Linked Files in the background but provides us with better tooling and makes it easier to get started developing
Conditional Compilation:
Means compiling the bits we need for that project; they compile to two different projects
Visibility:
Can add visible in the various elements to only show for that
Collapsed means it does not take up screen real estate or render time for that project
- Resource files can be used in XAML and code
- Shared project + conditional compilation is the most used
Platform differences is natural and expected on both the user and developer sides; targeting different devices and different user expectations
You can have responsive design to trap the switch from landscape to portrait
Can use Blend to design your UI
There are 191 Markets and 54 languages
WACK test for certification
Microsoft uses this tool before they manually test
Even use for side loading apps
Get a full report on pass/fail
You can reserve your app name well before you submit (or even build) your app
This value must be no more than 256 characters
Make sure that you use your reserved app name as the DisplayName in your app's manifest