Dresden, July 16th, 2014
Windows Phone 8.1platform concepts and app development
Advanced seminar by Sebastian Müller
Windows Phone 8.1 – platform concepts and app development #2July 16th, 2014
... Windows Mobile 6.5
Windows Phone 7
Windows Phone 8
Windows Phone 8.1
Windows CE
Windows NT
History of Microsoft‘s mobile operating systems
Windows Phone 8.1 – platform concepts and app development #3July 16th, 2014
Windows Phone 8.1 – platform concepts and app development #4July 16th, 2014
Hardware requirements
• Snapdragon CPU• 512MB, 1GB or 2GB RAM• 1080p, 720p, WXGA, qHD, FWVGA,
WVGA resolution• multi-touch display• rear-facing camera (VGA)• mobile data, WiFi, Bluetooth 4, A-GPS• accelerometer, proximity, ambient light
sensors• mechanical power, vol+, vol- buttons
Windows Phone 8.1 – platform concepts and app development #5July 16th, 2014
Apps
Windows Phone 8.1 – platform concepts and app development #6July 16th, 2014
App models
WP7
Silverlight
WP8
Silverlight
WP 8.1
Silverlight
WP 8.1
WinRT
Silverlight
Windows Phone 8 API
Windows Phone 8.1 API
WinRT
WP 7 API
WP 8.1
WinJS
WinJS
Windows Phone 8.1 – platform concepts and app development #7July 16th, 2014
App models
WP7
Silverlight
WP8
Silverlight
WP 8.1
Silverlight
WP 8.1
WinRT
Silverlight
Windows Phone 8 API
Windows Phone 8.1 API
WinRT
WP 7 API
WP 8.1
WinJS
WinJS
Windows Phone 8.1 – platform concepts and app development #8July 16th, 2014
App models
WP7
Silverlight
WP8
Silverlight
WP 8.1
Silverlight
WP 8.1
WinRT
Silverlight
Windows Phone 8 API
Windows Phone 8.1 API
WinRT
WP 7 API
WP 8.1
WinJS
WinJS
Windows Phone 8.1 – platform concepts and app development #9July 16th, 2014
Windows programming model
HTML / CSS
JavaScript
Windows Runtime
C# / VBC / C++
XAML
Input, Interaction, & Manipulation DirectX, Media, & Composition
Windows Kernel Services
http://channel9.msdn.com/Events/Build/2014/2-507
Windows Phone 8.1 – platform concepts and app development #10July 16th, 2014
• relatively low-level ABI
• WinRT components act as libraries
• written in C#, C++/CX
• metadata describes underlying API to
managed languages
Windows Runtime
Windows Phone 8.1 – platform concepts and app development #11July 16th, 2014
Windows Runtime
Chakra
CLRWindows Runtime Object
C++ App
HTML App
C#/VB App
Pro
jectio
nP
roje
ctio
nP
roje
ctio
n
Metadata(winmd)
Windows Phone 8.1 – platform concepts and app development #12July 16th, 2014
Windows Runtime projection
WinRT Type/Interface .NET Equivalent
Boolean Boolean
DateTime DateTimeOffset
Int64 Long
String String
IMap<K,V> IDictionary<K,V>
IVector<T> IList<T>
Windows Phone 8.1 – platform concepts and app development #13July 16th, 2014
Windows Runtime projection
WinRT pattern VB/C# pattern JavaScript pattern
AsyncOperation awaitable Task Promise
Event Event, += Event, addEventListener
Delegate Delegate function() …
Collections System.Collections.Generic
Array, hash
Windows Phone 8.1 – platform concepts and app development #14July 16th, 2014
Windows Runtime
Chakra
CLRWindows Runtime Object
C++ App
HTML App
C#/VB App
Pro
jectio
nP
roje
ctio
nP
roje
ctio
n
Metadata(winmd)
Windows Phone 8.1 – platform concepts and app development #15July 16th, 2014
Hello World!
Windows Phone 8.1 – platform concepts and app development #16July 16th, 2014
Development tools
Windows Phone 8.1 – platform concepts and app development #17July 16th, 2014
Hello world example
Windows Phone 8.1 – platform concepts and app development #18July 16th, 2014
App.xaml
<Application x:Class="HelloWorldApp.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Application.Resources> <SolidColorBrush x:Name="HelloWorldColorBrush" Color="Red" /> </Application.Resources> </Application>
Windows Phone 8.1 – platform concepts and app development #19July 16th, 2014
App.xaml.cs
public sealed partial class App : Application { public App() { InitializeComponent(); Suspending += OnSuspending; } protected override void OnLaunched(LaunchActivatedEventArgs e) { var rootFrame = Window.Current.Content as Frame; //... rootFrame.Navigate(typeof(MainPage), e.Arguments); //... Window.Current.Activate(); } private void FirstNavigated(object sender, NavigationEventArgs e) { //... } private void OnSuspending(object sender, SuspendingEventArgs e) { //... }}
Windows Phone 8.1 – platform concepts and app development #20July 16th, 2014
Hello Windows Phone!
Windows Phone 8.1 – platform concepts and app development #21July 16th, 2014
MainPage.xaml
<Page x:Class="HelloWorldApp.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Page.BottomAppBar <CommandBar> <AppBarButton Label="Hello" Click="BtnClicked" Icon="World"/> </CommandBar> </Page.BottomAppBar>
<Grid VerticalAlignment="Center" HorizontalAlignment="Center"> <TextBlock x:Uid="HelloWorldTxt" x:Name="TextBlock1" Style="{ThemeResource GroupHeaderTextBlockStyle}" Foreground="{ThemeResource PhoneAccentBrush}" Text="Hello world!" /> </Grid></Page>
Windows Phone 8.1 – platform concepts and app development #22July 16th, 2014
MainPage.xaml.cs
public sealed partial class MainPage : Page {
public MainPage() { InitializeComponent(); NavigationCacheMode = NavigationCacheMode.Required; }
protected override void OnNavigatedTo(NavigationEventArgs e) { //... }
private void BtnClicked(object sender, RoutedEventArgs e) { //... }
}
Windows Phone 8.1 – platform concepts and app development #23July 16th, 2014
Hello Windows Phone!
Windows Phone 8.1 – platform concepts and app development #24July 16th, 2014
An app‘s lifecycle
http://msdn.microsoft.com/en-us/library/windows/apps/hh464925.aspx
Windows Phone 8.1 – platform concepts and app development #25July 16th, 2014
Communication / Contracts
• file associations
• URI contracts
• share
• file save picker
• file open picker
Windows Phone 8.1 – platform concepts and app development #26July 16th, 2014
Secondary and Live Tiles
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh202948(v=vs.105).aspx
Windows Phone 8.1 – platform concepts and app development #27July 16th, 2014
Secondary Tiles
http://channel9.msdn.com/Events/Build/2014/2-537
Windows Phone 8.1 – platform concepts and app development #28July 16th, 2014
Live Tiles
http://msdn.microsoft.com/en-us/library/windows/apps/dn632423.aspx
Windows Phone 8.1 – platform concepts and app development #29July 16th, 2014
Background tasks
Trigger Usage
System Trigger
UserPresent, UserAway, SessionConnected, TimeZoneChange, NetworkStateChange, InternetAvailable, ServicingComplete, GattCharacteristicNotificationTrigger, DeviceChangeTrigger, DeviceUpdateTrigger, RfcommConnectionTrigger
Run code on system events
TimeTrigger Data synchronization
MaintenanceTrigger Perform maintenance work on AC power
http://channel9.msdn.com/Events/Build/2014/2-518
Windows Phone 8.1 – platform concepts and app development #30July 16th, 2014
Battery Saver
http://channel9.msdn.com/Events/Build/2014/2-518
Windows Phone 8.1 – platform concepts and app development #31July 16th, 2014
Action Center
• add/edit/remove
(ghost) notifications
• in-app, triggered,
scheduled, push
Windows Phone 8.1 – platform concepts and app development #32July 16th, 2014
• Local• isolated• app-specific
• LocalCache• not included in backups
• Roaming• cloud synced• size limit
• Temporary• transient
• PasswordFault• sensitive information
• Project• install folder
Storage and Settings
Windows Phone 8.1 – platform concepts and app development #33July 16th, 2014
XAML: Images/logo.png
E.g. loads: Images/en-US/homeregion-USA/logo.scale-140_contrast-white.png
Standard naming convention:foldername/qualifiername-value/qualifiername-value/filename.qualifiername-value_qualifier name-value.ext
Resources and localization
Windows Phone 8.1 – platform concepts and app development #34July 16th, 2014
Key Value
HelloWorldTxt.Text Hello Windows Phone
HelloWorldTxt.Background Blue
HelloWorldTxt.TextAlignment Right
HelloWorldTxt.FlowDirection RightToLeft
Resources and localization
<TextBlock x:Uid="HelloWorldTxt" Style="{ThemeResource GroupHeaderTextBlockStyle}" Foreground="{ThemeResource PhoneAccentBrush}" Text="Hello world!" />
Windows Phone 8.1 – platform concepts and app development #35July 16th, 2014
App package
ZIP container
Files / Assets
AppXManifest.xml
BlockMap
Signature
• local: appx or appxbundle• cloud:
- machine code for each device- security signature
Windows Phone 8.1 – platform concepts and app development #36July 16th, 2014
Voice commands
<?xml version="1.0" encoding="utf-8"?><VoiceCommands xmlns="http://schemas.microsoft.com/voicecommands/1.1"> <CommandSet xml:lang="en-us" Name="englishCommands"> <CommandPrefix> MSDN </CommandPrefix> <Example> find 'Windows Phone Voice Commands' </Example> <Command Name="MSDNSearch"> <Example> find 'how to install CommandSets' </Example> <ListenFor> Search </ListenFor> <ListenFor> Search [for] {dictatedSearchTerms} </ListenFor> <ListenFor> Find {dictatedSearchTerms} </ListenFor> <ListenFor> Find </ListenFor> <Feedback> Searching MSDN... </Feedback> <Navigate Target="MainPage.xaml" /> </Command> <PhraseTopic Label="dictatedSearchTerms" Scenario="Search"> <Subject> MSDN </Subject> </PhraseTopic> </CommandSet></VoiceCommands>
Windows Phone 8.1 – platform concepts and app development #37July 16th, 2014
Metro Design Language
Windows Phone 8.1 – platform concepts and app development #38July 16th, 2014
Metro Design Language
Windows Phone 8.1 – platform concepts and app development #39July 16th, 2014
Thank you
Questions