Martin Suchan – BloQ Random #WPdev stuff

5Jan/150

Windows Phone 8.1 SDK, 9 month later, what’s new

The Windows Phone 8.1 SDK was released with a bang at the beginning of April 2014 and the OS update arrived later that year. It brought lot of new to the Windows Phone ecosystem, but also caused a noticeable disarray to the Windows Phone community and to the community of developers as well. Some features in WP8.1 are definitely great and improving, some are just worrisome, and some features in WP8.1 SDK are simply missing, even though they were in WP8.

Let's take a look on the WP8.1 SDK nine months after the original release, what improvements it brought and also what's still not there.

In this dev article about Windows Phone 8.1 SDK, 9 month later I'll summarize in few bullet points the most interesting features of this OS update and especially what's new for developers.

New project types in Windows Phone 8.1 SDK

  • New WP8.1 XAML C# project format based on Windows 8.1 project format
  • New WP8.1 Silverlight C# project format for "legacy" apps, based on WP8 where most of the new WP8.1 API is now accessible
  • New WP8.1 HTML/JavaScript projects for native app development using HTML, JavaSript and WinJS
  • New C++ project templates for developing either standard apps or DirectX games 
  • New Universal Windows Apps - project templates for developing WP8.1 and Windows 8.1 apps at the same time with an ease, available both in C# and HTML/JavaScript

The most interesting addition were in my opinion two new WP8.1 C# project types. As you look at the graph below, the Silverlight project app is based directly on previous WP8, but the other one is a brand new platform, discarding all old Silverlight-based API and embracing fully the new Windows Runtime API, that is already used in Windows 8.1 for tablet "Modern" apps. The differences between these two will be detailed in another article.

dd8_evolucewp

 

 

 

 

 

 

 

 

 

 

 

What are the requirements for developing WP8.1 apps?

  • They are mostly similar to WP8
  • PC with Windows 8.1 x64 or Windows 10
  • Visual Studio 2013 with Update 2+ or Visual Studio 2015 Preview or newer
  • Pro or Enterprise edition of Windows and CPU supporting SLAT instructions for running the WP Emulator, that is based on Hyper-V

Note although you can find some guides, how to develop WP apps on a Windows running on virtual machine, I really recommend running your Windows on bare metal for maximum performance and problem-free dev experience.

 Areas of convergence with Windows 8.1

First time since WP7, the Windows Phone 8.1 XAML platform is based on something different than Silverlight - this time on Windows Runtime. This is HUGE. If you are familiar with Windows 8.1 app development, you'll notice that about 90-95% of API, XAML and app workflows is in WP8.1 almost identical with Windows.

Application model and app lifetime - WP8.1 uses same Application lifecycle model as Windows 8.1 - Start, Suspending, Resuming/Activation, Termination. Also the API for running tasks in background is mostly similar and can be reused.

IC576232

 

 

 

 

 

 

 

 

 

App manifest, packaging and deployment - the application manifest file Package.appxmanifest has similar structure and also the final package is mostly similar - zip file with appx attachment.

XAML UI Framework - WP8.1 apps use newer version of XAML format based on Windows 8.1 XAML, in constrast with WP8 apps that use older XAML based on Silverlight. The benefit here is that you can now share most of Styles and Templates between phone and tablet projects and define them now even in Portable Class Libraries or Shared ode projects.

New API in Windows Phone 8.1, the best parts

Geolocation and Geofencing - WP8.1 contains new geolocation API including new API for reminders based on location, triggered when arriving or leaving certain area. This API is heavily used especially in Cortana for managing tasks like "remind me when I arrive home to call Jane".

Background transfers - new background transfer API located in the Windows.Networking.BackgroundTransfer namespace gives you better control over files, that can be downloaded or uploaded even when the app is not running.

Media editing - with the help of Windows.Media.Editing API it's now possible to edit video and audio tracks directly in your phone - capturing video, cropping, combining, even using more audio tracks at once.

Notification - WP8.1 XAML apps now use new Windows Notification Service (WNS) just like it's used in Windows 8.1. Even the API for displaying Toast and Tile notifications is now basically same. It's also possible to access programatically the new Action Center and manage the notifications here.

Windows Media Foundation - WP8.1 brings several new improvements to DirectX, that can be used in the app:

  • Direct2D APIs
  • DirectWrite APIs
  • Windows Imaging Component APIs
  • Runtime shader compilation and reflection
  • GPU access to YUV shaders
  • GPU performance counters
  • Graphics diagnostics support
  • Improved DirectX and XAML interop

Screen recording - thanks to the Windows.Media.Capture API it's now possible to record application screen content as a video.

UI automation - WP8.1 contains API for UI automation that helps you build automated UI tests and also improve the accessibility of your app.

New and shared UI Controls - Windows Phone 8.1 uses same UI stack as Windows 8.1 and therefore it's possible to use lot of elements across both apps. Some elements are almost identical like TextBox, Button, Grid. Some controls previously from Windows 8.1 like GridView, ListView, FlipView now can be used in Windows Phone as well. Some originally Phone-only controls were renamed like Panorama->Hub, context menu->Flyout. Finally small number of controls is still available only for phone projects, e.g. Pivot.

New AppBar - as requested by many developers, the Application Bar now fully uses Dependency properties, supports databinding and other dynamic scenarios. The AppBar and CommandBar API is also very similar to Windows 8.1 AppBar with only platform specific UI rendering.

Monetization options - API for managing In-App purchases and products is now unified with Windows 8.1. New feature in WP8.1 is also the CurrentAppSimulator, that can be used for testing purchases on Windows Phone.

NFC and proximity - improvements were made to the NFC API, that is now capable to create NDEF formatted tag from Raw NFC tag, Locking tags or even creating Bluetooth pairing and Handover records.

Data management and storage improvements

Windows.Storage API - WP8.1 now almost fully implements Windows Storage API from Windows 8.1 including support for Roaming and Temp folders. It's also possible to use new File Open and File Save pickers and contracts.

Data Roaming - WP8.1 now allows sharing of app settings or files between devices using new Roaming folder. It's also possible to share data between linked Windows and Phone apps with the same name!

Share contract - new share contract similar to the one from Windows 8.1 enables broad new scenarios for sending and receiving data between apps.

Improved support for SD cards - WP8 originally supported opening files of known types from SD card. WP8.1 now enables reading and writing files from/to SD card using either Known Folders or File Open and File Save pickers.

Improvements of Developer tools

New WP8.1 emulators - the initial WP8.1 SDK gave us 6 new emulators: WVGA 512MB 4", WVGA 4", WXGA 4", 720p 4,7", 1080p 5,5" and 1080p 6". Later additional WP8.1 GDR 1 emulators were released.

These emulators were also improved a lot since WP8:

  • more reliable network bridges when running emulators on your PC, no more "no Internet" issues with emulators
  • new physical buttons on emulator sides: On, Volume Up and Down, Camera shutter button
  • new tool for simulating multitouch gestures
  • more options when simulating GPS data
  • Network speed simulation Dashboard directly in Emulator settings
  • SD card simulation by linking to target folder on PC
  • Push notification simulation center
  • Checkboxes for selecting optional sensors, that should be available in the emulator
  • Probably the most interesting feature - Emulator checkpoints for saving interesting emulator states

Windows Phone Develper Power Tools - new set of tools for testing application performance, memory consumption and profiling, recording app performance over time and more.

Blend for Visual Studio, Developer Registration Tool, Application Deployment Tool, Isolated Storage Explorer - these tools were also updated for supporting Windows Phone 8.1

New .NET Core API available in WP8.1

  • System.Collection.Concurrent - useful collections for solving tasks like consumer&producer, etc.
  • System.IO.Compression - ZipArchive, GZipStream
  • ParallelQuery, ParallelEnumerable
  • System.Numerics - BigInteger, Complex
  • System.Threading.Tasks - Parallel.For, Parallel.ForEach

Summary

As you can see Windows Phone 8.1 is primarily about platform convergence with Windows. The platform compatibility is now about 90-95% and even though there are still some missing APIs, it's now much easier to develop apps for both platforms at once, especially with the introducing of Universal Windows Apps.

Additionally, the new Windows Phone 8.1 "Silverlight" project format for supporting "legacy" apps is also really useful for adding new features to existing apps without the need of rewriting the whole app.