Windows 8 and windows phone 8 developer story anders bratland

Preview:

DESCRIPTION

Windows 8 and windows phone 8 developer story by Anders Bratland. Keynote speech at NETwork 2012 http://network-ua.com/

Citation preview

Windows 8 & Windows Phone 8 Developer story

So, what’s the latest on Windows 8?

I went to Redmond to find out!

… wait for it …

nothing!!

Anders Bratland

Microsoft Extended Experts TeamMicrosoft Certified TrainerMetro Trainers

Who am I?

anders@bratland.se @abratland

Ok, maybe that wasn’t the whole truth about windows 8…

Mobile ServicesMedia ServicesWindows Phone 8

The state of Windows 8Just releasedDeveloper tools in placeWindows Store in placeFocus on building apps!

What about Windows Phone 8?

The state of Windows Phone 8!Built on the same core as Windows 8API’s and features are not the same but they are converging

Tiles and lock screen notificationsFlipTileData - this is the regular live tile that we are used to seeing in Windows Phone 7 IconicTileData - similar to the FlipTile but follows more closely the Windows Phone design principles and displays an icon instead of an image CycleTileData - can cycle up to 9 images, similar to the Pictures live tile

New Map controlNokia MapsOffline mapsShared between applicationsBing Maps still works, but is deprecated.

File and URI Associations

New Communication and Proximity APIsBluetoothNFC VoIPSpeech

Introducing: Fast App ResumeAllows your app to always resume no matter where it’s launched from:App listLive TileToastDeep link

If your app is in the back stack then we will resume it

If it’s not then we will launch a new instance

Enabling FAR in your appNot enabled by default. Why?Protect your user experienceEnsure that apps don’t break

One simple property!New ActivationPolicy attribute on DefaultTask

How can we build for both?

Build for Windows Store & Windows PhoneMVVMPortable Class LibraryAbstract away and inject device specific code

demo

Thanks' for listening!

anders@bratland.se @abratland

Communication

& Data

Devices & Printing

WinRT APIsDirectX &

Media

Windows 8Desktop Apps

CC++

Win32

C#VB

.NET SL

HTMLJavaScrip

t

Internet Explore

r

Windows Store Apps

Application Model

XAML

JavaScript

HTML / CSS

CC++

C#VB

Windows Kernel Services

Syste

m

Serv

ices

Vie w

Mod

el

Con

trolle

rK

ern

el

Share SettingsSearch

App to App Picking

Play To

demoFile picker

Search

demoSearch in Windows 8

Implementing Search

Search Anatomy

1. Search box is scoped to the main app on screen

2. Query suggestions provided by the main app on screen• Autocompletes to terms for which the app has search results

3. List of installed Metro style apps that have implemented the search contract

1

2

3

Chris Mayo
Replace with build, talk about main app vs. launch. Provide a search results pane.

demoImplementing Search

Share

demoShare

Implementing Share

Sharing From Source to TargetShare Target AppShare Broker

User selects “Share”, active app is sent

event

Activated for sharing

Registers with the DataTransfer

Manager

Source App

Filters list of Target Apps and Quicklinks

User selects Target App or Quicklink

Processes DataPackage contents

Reports Complete

Completes Async calls and returns

Receives event and fills DataPackage

DataPackage lives in source

application

Activate Target as kind shareTarget

Data PackagePlain text

Formatted text

URI

HTML

Images

Files

Custom data formats

App Lifecycle

When Do Apps Run? Windows 8 System manages app lifetimeWindows 7 User manages app

lifetime

demoTask switching

Process Lifetime Walkthrough

Running

Terminated

SuspendedApp terminated under memory

pressure without notification

App 1 App 2 App 3 App N

Apps suspend after a short delay

Apps resume instantly from

suspend

Introducing Suspend

System resources focused on the app that the user is interacting with in the foreground

Inactive apps have no impact on battery life or responsiveness, they are suspended by the OS

Enables instant switching between apps!

Termination

System needs more memory User switch occurs User closes the app System shutdown Apps crash

Apps do not get notified when they are getting terminated

Registering for Suspend and Resume is Easy

//Register for the Suspending event and call Current_Suspending when receivedApp.Current.Suspending += Current_Suspending;

//Handle the suspending event and save the current user session using WinJS sessionStatevoid Current_Suspending(object sender, Windows.ApplicationModel.SuspendingEventArgs e){ //We are getting suspended } //Register for the Resuming event and call resumingHandler when received App.Current.Resuming += Current_Resuming;

void Current_Resuming(object sender, object e){

//We are getting resumed, in general do nothing

}

Suspend Under the Hood

Suspended apps are not scheduled by the NT Kernel

No CPU, Disk or Network consumed All threads are suspended Apps remain in memory Kernel ensures apps are not suspended in critical

sections that could cause system wide deadlocks Apps instantly resumed from suspend

when brought to foreground

Launching Apps

Changing How Apps Are LaunchedApp launch from Start Activate from tile, search, share,

etc.

App Activation Through ContractsApps are activated through contractsLaunch, search, ShareTarget, etc.

Apps need to initialize contract specific actions

Context is provided

Running App

launch

shareTarget

activated

kind

search

Activationprotected async override void OnLaunched(LaunchActivatedEventArgs args){ if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { // Do an asynchronous restore await SuspensionManager.RestoreAsync(); }

if (args.Kind == ActivationKind.Launch) { if ( !string.IsNullOrEmpty ( args.Arguments ) { // handle arguments } } else if ( args.Kind == ActivationKind.ShareTarget ) { } // … }

Splash Screens During Activation

System provided Splash Screen mechanism provides consistent transition to your app

Shown while Windows launches your app

Presented during activation

Developer provides color and image in app manifest

Apps need to present a window within 15 seconds of activation or the app will be terminated

Extended Splash Screens

After first run of your app, cache data so next launchcan show content promptly

For apps that need longer toload

1. Have the first view of your app imitate your splash screen

2. On Activated event handler, position yourview appropriately

3. Add a progress indicator or some other interactive UI so the user knows whatthe app is doing

Most important in Windows 8Fast and fluidModern UI StyleApplication Life CycleContracts

A good released app > a great unreleased app