68
Windows Phone 7 Windows Phone 7 overview Soumow Atitallah 1

Windows phone 7 overview

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Windows phone 7 overview

Windows Phone 7

Windows Phone 7 overview

Soumow Atitallah

1

Page 2: Windows phone 7 overview

Windows Phone 7

Introduction

2

Page 3: Windows phone 7 overview

Windows Phone 7

Introduction

A bit of history…

First version

of Pocket PC

2000

Usage of the name

Windows Mobile

2003

Windows

Mobile 5

2005

Windows

Mobile 6

2007

Begining of major

WM Update :

« Photom »

Windows

Phone 6.5

2009

Zune HD

2009

Windows

Phone 7

2010

3

Page 4: Windows phone 7 overview

Windows Phone 7

Introduction

A bit of history…

Now

Fall 2011 : Release of Mango

4

Page 5: Windows phone 7 overview

Windows Phone 7

Introduction

The break point

Windows Phone 7 has :

No Retro-compatibility with Windows

Mobile

Based on Windows CE 6

New Interface based-on Metro UI

Hardware requirements

Good-bye Stylus !

5

Page 6: Windows phone 7 overview

Windows Phone 7

Introduction

The interface : Metro UI

Metro UI

6

Page 7: Windows phone 7 overview

Windows Phone 7

Introduction

Consistent set of

hardware capabilities

defined by Microsoft

One resolution at launch

Second resolution added later

Same touch input

Consistent processor / GPU

Same available RAM

Optional keyboard

Consistent

Platform

Windows

Phone

Hardware

Common

Hardware

Elements

Quality

Focus

7

Page 8: Windows phone 7 overview

Windows Phone 7

Introduction : Original hardware requirements

Touch 4 points of contacts

Sensors A-GPS, Accelerometer, Luminosity, …

APN 5 Megapixels minimum, flash

Multimedia Codecs, Smooth Streaming

Memory 256 Mo RAM minimum, 8Go of flash memory minimum

GPU DirectX

CPU 1GHz or more

Buttons | Back, Start, Search

8

Page 9: Windows phone 7 overview

Windows Phone 7

Introduction : Developement technologies

User interfaces in XAML

Easy & quick to create rich visuel

applications

Metro-UI themed controls

500 000 developers spanning Windows

& Web

High performance game framework

Rapid creation of multi-screen 2D & 3D

games

Rich content pipeline

Mature, robust, widely adopted

spanning Xbox 360, Windows & Zune.

11

Page 10: Windows phone 7 overview

Windows Phone 7

Introduction

Kernel

Hardware BSP

App Model UI Model Cloud Integration

Applications

App management Licensing Chamber isolation Software updates

Shell frame Session manager Direct3D Compositor

Xbox LIVE Bing Location Push notifications Windows Live ID

Your App UI and logic

A-GPS Accelerometer Compass Light Proximity Media Wi-Fi Radio Graphics

Security Networking Storage

Frameworks

Silverlight XNA HTML/JavaScript

CLR

Hardware Foundation

12

Page 11: Windows phone 7 overview

Windows Phone 7

Introduction : App Model Concepts

Application Uniquely identifiable,

licensable and serviceable

software product packaged

as a XAP

Application Deployment Steps include Ingestion,

Certification and Signing

Application license Crypto-verifiable object

issued to grant rights to

an application

Windows Phone

Marketplace

Windows Phone

Marketplace

13

Page 12: Windows phone 7 overview

Windows Phone 7

Introduction : Deployement and distribution process

Develop & Debug

Submit & Validate

Certify & Sign

Windows Phone Application Deployment Service

Marketplace

14

Page 13: Windows phone 7 overview

Windows Phone 7

Introduction : Developement tools

OR Third party IDE

w/ Windows

Phone SDK

You can also use Visual studio 2010 Express Edition for Windows Phone

SDK Available at : http://developer.windowsphone.com/ 15

Page 14: Windows phone 7 overview

Windows Phone 7

Basics : Controls

Some of the controls : Pivot

Panorama

Bing maps

DatePickers

Time Pickers

…. And more in the SL toolkit

17

Page 15: Windows phone 7 overview

Windows Phone 7

Tasks

18

Page 16: Windows phone 7 overview

Windows Phone 7

Some of the Tasks

AddressChooserTask

BingMapsDirectionsTask

BingMapsTask

ConnectionSettingsTask

GameInviteTask

PhoneCallTask

SmsComposeTasks

WebBrowserTask

SaveContactTask

SaveRingtoneTask

ShareLinkTask

ShareStatusTask 19

Page 17: Windows phone 7 overview

Windows Phone 7

Tasks : AddressChooserTask

AddressChooserTask addressChooserTask;

addressChooserTask = new AddressChooserTask(); addressChooserTask.Completed += new EventHandler<AddressResult>(addressChooserTask_Completed);

try { addressChooserTask.Show(); } catch (System.InvalidOperationException ex) { MessageBox.Show("An error occurred."); }

void addressChooserTask_Completed(object sender, AddressResult e) { if (e.TaskResult == TaskResult.OK) { MessageBox.Show("The address for " + e.DisplayName + " is " + e.Address); } }

20

Page 18: Windows phone 7 overview

Windows Phone 7

Tasks : BingMapsDirectionsTask

BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask(); // You can specify a label and a geocoordinate for the end point. // GeoCoordinate spaceNeedleLocation = new GeoCoordinate(47.6204,-122.3493); // LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", spaceNeedleLocation); // If you set the geocoordinate parameter to null, the label parameter is used as a search term. LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", null); bingMapsDirectionsTask.End = spaceNeedleLML; // If bingMapsDirectionsTask.Start is not set, the user's current location is used as the start point. bingMapsDirectionsTask.Show();

21

Page 19: Windows phone 7 overview

Windows Phone 7

Tasks : BingMapsTask

BingMapsTask bingMapsTask = new BingMapsTask(); //Omit the Center property to use the user's current location. //bingMapsTask.Center = new GeoCoordinate(47.6204, -122.3493); bingMapsTask.SearchTerm = "coffee"; bingMapsTask.ZoomLevel = 2; bingMapsTask.Show();

22

Page 20: Windows phone 7 overview

Windows Phone 7

Tasks : ConnectionSettingsTask

ConnectionSettingsTask connectionSettingsTask = new ConnectionSettingsTask(); connectionSettingsTask.ConnectionSettingsType = ConnectionSettingsType.WiFi; connectionSettingsTask.Show();

23

Page 21: Windows phone 7 overview

Windows Phone 7

Tasks : GameInviteTask

GameInviteTask gameInviteTask; gameInviteTask = new GameInviteTask(); gameInviteTask.Completed += new EventHandler<TaskEventArgs>(gameInviteTask_Completed);

try { gameInviteTask.SessionId = "<my session id>"; gameInviteTask.Show(); } catch (System.InvalidOperationException ex) { MessageBox.Show("An error occurred."); }

void gameInviteTask_Completed(object sender, TaskEventArgs e) { switch(e.TaskResult) { //Game logic for when the invite was sent successfully case TaskResult.OK: MessageBox.Show("Game invitation sent."); break; / //Game logic for when the invite is cancelled by the user case TaskResult.Cancel: MessageBox.Show("Game invitation cancelled."); break; // Game logic for when the invite could not be sent case TaskResult.None: MessageBox.Show("Game invitation could not be sent."); break; } }

24

Page 22: Windows phone 7 overview

Windows Phone 7

Tasks : SaveContactTask

SaveContactTask saveContactTask; saveContactTask = new SaveContactTask(); saveContactTask.Completed += new EventHandler<SaveContactResult>(saveContactTask_Completed);

try { saveContactTask.FirstName = "John"; saveContactTask.LastName = "Doe"; saveContactTask.MobilePhone = "2065550123"; saveContactTask.Show(); } catch (System.InvalidOperationException ex) { MessageBox.Show("An error occurred."); }

25

Page 23: Windows phone 7 overview

Windows Phone 7

Tasks : SaveContactTask

Company Gets or sets the name of the company associated with the contact.

FirstName Gets or sets the given name of the contact.

HomeAddressCity Gets or sets the city of the home address associated with the

contact.

HomeAddressCountry Gets or sets the country or region of the home address associated

with the contact.

HomeAddressState Gets or sets the state of the home address associated with the

contact.

HomeAddressStreet Gets or sets the street name and number of the home address

associated with the contact.

HomeAddressZipCode Gets or sets the postal code of the home address associated with

the contact.

HomePhone Gets or sets the home phone number associated with the contact.

JobTitle Gets or sets the job title associated with the contact.

LastName Gets or sets the surname of the contact.

MiddleName Gets or sets the middle name of the contact.

MobilePhone Gets or sets the mobile phone number associated with the contact.

Nickname Gets or sets the nickname of the contact.

Notes Gets or sets a note associated with the contact.

OtherEmail Gets or sets an additional email address associated with the

contact.

PersonalEmail Gets or sets the personal email address associated with the contact.

Suffix Gets or sets the suffix of the name of the contact.

Title Gets or sets the title of the name of the contact.

Website Gets or sets the website associated with the contact.

WorkAddressCity Gets or sets the city of the work address associated with the

contact.

WorkAddressCountry Gets or sets the country or region of the work address associated

with the contact.

WorkAddressState Gets or sets the state of the work address associated with the

contact.

WorkAddressStreet Gets or sets the street name and number of the work address

associated with the contact.

WorkAddressZipCode Gets or sets the postal code of the work address associated with

the contact.

WorkEmail Gets or sets the work email address associated with the contact.

WorkPhone Gets or sets the work phone number associated with the contact.

26

Page 24: Windows phone 7 overview

Windows Phone 7

Tasks : SaveRingtoneTask

try { saveRingtoneChooser.Source = new Uri("appdata:/ReneLaTaupe.mp3"); //saveRingtoneChooser.Source = new Uri("isostore:/ReneLaTaupe.mp3"); saveRingtoneChooser.DisplayName = "My custom ringtone"; saveRingtoneChooser.Show(); } catch (System.InvalidOperationException ex) { MessageBox.Show("An error occurred."); }

27

Page 25: Windows phone 7 overview

Windows Phone 7

Tasks : ShareLinkTask

ShareLinkTask shareLinkTask = new ShareLinkTask(); shareLinkTask.Title = "Code Samples"; shareLinkTask.LinkUri = new Uri("http://soumow.dollon.net", UriKind.Absolute); shareLinkTask.Message = "Have you seen the latest demo ?"; shareLinkTask.Show();

28

Page 26: Windows phone 7 overview

Windows Phone 7

Live Tiles & Push Notifications

29

Page 27: Windows phone 7 overview

Windows Phone 7

Live Tiles

Live Tiles allow content on a

tile to be updated and

changed remotely to signifly

a change in the backend

application

30

Page 28: Windows phone 7 overview

Windows Phone 7

Creating a tile

ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative),

new StandardTileData(){

BackgroundImage = new Uri("isostore:/Shared/ShellContent/image.png",

UriKind.Absolute),

Title = "Sample"});

Tiles are recto and verso

There are also some additional properties that you can use in addition to the basic ones: BackContent - used to display a string onthe back of the tile. The tile itself will automatically rotate betwen the

base and secondary content.

BackTitle - the title to be displayed on the back of the tile.

Count - the count displayed in the corner of the tile. Only displayed on the front side of the tile.

BackBackgroundImage - the background image displayed on the back of the tile.

31

Page 29: Windows phone 7 overview

Windows Phone 7

Update/Deleting tiles

Tiles can expire or need updating

Enumerate the tiles associated with the application, accessible

through the ShellTile.ActiveTiles IEnumerable:

For each shell tile, we can either Update it (and pass a new

instance of StandardTileData with updated content) or Delete it.

foreach (ShellTile tile in ShellTile.ActiveTiles){

Debug.WriteLine(tile.NavigationUri.ToString());

}

32

Page 30: Windows phone 7 overview

Windows Phone 7

Push Notifications

3 Types of Push

Notifications

Toast Notifications

Tile Notifications

Raw Notifications

33

Page 31: Windows phone 7 overview

Windows Phone 7

Push Notifications : Toast Notifications

Title. A boldface string that displays immediately after the application icon. This is defined as

the Text1 property in the XML schema.

Content. A non-boldface string that displays immediately after the Title. This is defined as the

Text2 property in the XML schema.

Parameter. A parameter value that is not displayed but passed to your application if the user

taps on the toast. This parameter can indicate what page the application should launch to. It

can also contain name-value pairs to pass to the application. This is defined as the Param

property in the XML schema.

34

Page 32: Windows phone 7 overview

Windows Phone 7

Multitasking

35

Page 33: Windows phone 7 overview

Windows Phone 7

Fast App switching

36

Page 34: Windows phone 7 overview

Windows Phone 7

Application Lifecycle Pre-Mango

Running

Deactivated

Tombstoned

Activated

Save state Restore state

37

Page 35: Windows phone 7 overview

Windows Phone 7

Application Lifecycle in Mango

Running

Deactivated

Dormant

Activated

Tombstoned Save state

Restore

state

38

Page 36: Windows phone 7 overview

Windows Phone 7

Application Lifecycle in Mango

private void Application_Launching(object sender, LaunchingEventArgs e)

{

}

Launch Event

Deactivated Event private void Application_Deactivated(object sender, DeactivatedEventArgs e)

{

}

Activated Event private void Application_Activated(object sender, ActivatedEventArgs e)

{

if(e.IsApplicationInstancePreserved == true)

{

// Dormant State

}

else

{

// Tombstoned State

}

}

Close Event private void Application_Closing(object sender, ClosingEventArgs e) {

}

39

Page 37: Windows phone 7 overview

Windows Phone 7

Background Agents

40

Page 38: Windows phone 7 overview

Windows Phone 7

What are background agents?

Background Agents are a seperate project from the

application you are creating.

They are instantiated when the application isn’t in an

active state. When the application is in an active state,

they don’t run.

Maximum of 18 simultaneous agents.

Background Agents are desactivated 14 days if they are

never used.

41

Page 39: Windows phone 7 overview

Windows Phone 7

What can/can’t you do with Background Agents

Allowed Not Allowed

Tiles

Toast

Location Services

Connectivity

Access to

IsolatedStorage

Sockets

Most APIs

Interact with UI

XNA Libraries

Microphone & Camera

Sensors

Play audio without using

the appropriate APIs for

background sound

42

Page 40: Windows phone 7 overview

Windows Phone 7

Background Transfer Service

Background Audio

Background Agents

Periodic

On Idle

Alarms and Reminders

Background Agents

43

Page 41: Windows phone 7 overview

Windows Phone 7

Background Agents

Background Agents in Mango take the form of a separate assembly, which gets linked

in your WMAppManifest.xml

44

Page 42: Windows phone 7 overview

Windows Phone 7

Background Agents Background Transfer Service

45

Page 43: Windows phone 7 overview

Windows Phone 7

Background Agents : Background Transfer Service

Start in foreground, complete in background, even if

app is closed

Queue (of 5) persists across reboots

Single service for many apps, FIFO

Download ~20 MB ( > over Wi-Fi)

Upload Size ~4 MB (limit to come)

Transfers to Isolated Storage 46

Page 44: Windows phone 7 overview

Windows Phone 7

Background Agents : Background Transfer Service

47

Page 45: Windows phone 7 overview

Windows Phone 7

Background Agents ScheduledTask Agent

48

Page 46: Windows phone 7 overview

Windows Phone 7

Background Agents : ScheduledTask Agent

It is possible to have in Windows Phone 7 to execute code

as a planned tack.

There are two types of scheduled tasks therefore one class

that from ScheduledTask for each of these types :

PeriodicTask and ResourceIntensiveTask

49

Page 47: Windows phone 7 overview

Windows Phone 7

Background Agents : ScheduledTask Agent

Limitations: Memory 5 Mo

Expiration : 2 Weeks

Restrained acces to APIs

User can desactivate them

PeriodicTask : Every 30 minutes (+/-) for 15 seconds

Can be dismissed if two many background agents are active

ResourceIntensiveTask Runs for 10 minutes

Only runs if the phone is plugged in

If the phone is connected to Wifi or PC

If the phone is 90% Charged

If absolutely no application is running on the phone

50

Page 48: Windows phone 7 overview

Windows Phone 7

Background Agents : ScheduledTask Agent

PeriodicTask periodicTask = new PeriodicTask("TaskUniqueNameInApp"); periodicTask.Description = "My Periodic Task Description"; periodicTask.ExpirationTime = DateTime.Now.AddDays(10); ScheduledActionService.Add(periodicTask);

Microsoft.Phone.Scheduler.PeriodicTask

Microsoft.Phone.Scheduler.ResourceIntensiveTask

ResourceIntensiveTask intensiveTask new ResourceIntensiveTask("TaskUniqueNameInApp"); intensiveTask.Description = "My Intensive Task Description"; intensiveTask.ExpirationTime = DateTime.Now.AddDays(10); ScheduledActionService.Add(intensiveTask)

51

Page 49: Windows phone 7 overview

Windows Phone 7

Background Agents : ScheduledTask Agent

public class TaskScheduler : ScheduledTaskAgent { protected override void OnInvoke(ScheduledTask task) { if (task is PeriodicTask) { } else //is ResourceIntensiveTask { } NotifyComplete(); } }

Then create a class that inherits of ScheduledTaskAgent and override OnInvoke and OnCancel

52

Page 50: Windows phone 7 overview

Windows Phone 7

Using APIs, Camera & Sensors

53

Page 51: Windows phone 7 overview

Windows Phone 7

Sockets

54

Page 52: Windows phone 7 overview

Windows Phone 7

Sockets

Windows Phone provides the programming interface needed to create and use TCP and UDP sockets. You can select

which type of socket to use based on your application’s needs.

55

Page 53: Windows phone 7 overview

Windows Phone 7

Sockets

using System.Net.Sockets;

public string Connect(string hostName, int portNumber) { DnsEndPoint hostEntry = new DnsEndPoint(hostName, portNumber); _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs(); socketEventArg.RemoteEndPoint = hostEntry; socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>( delegate(object s, SocketAsyncEventArgs e) { result = e.SocketError.ToString(); _clientDone.Set(); }); _clientDone.Reset(); _socket.ConnectAsync(socketEventArg); _clientDone.WaitOne(TIMEOUT_MILLISECONDS); }); return result; }

56

Page 54: Windows phone 7 overview

Windows Phone 7

Contacts/Calendar

57

Page 55: Windows phone 7 overview

Windows Phone 7

Contacts/Calendar

In Windows Phone, you can now access the user information asynchrously, and even better you can query them with

Linq !!!

using Microsoft.Phone.UserData;

private void ButtonContacts_Click(object sender, RoutedEventArgs e) { Contacts cons = new Contacts(); //Identify the method that runs after the asynchronous search completes. cons.SearchCompleted += new EventHandler<ContactsSearchEventArgs>(Contacts_SearchCompleted); //Start the asynchronous search. cons.SearchAsync(String.Empty, FilterKind.None, "Contacts Test #1"); } void Contacts_SearchCompleted(object sender, ContactsSearchEventArgs e) { //Do something with the results. MessageBox.Show(e.Results.Count().ToString()); }

Get contacts:

58

Page 56: Windows phone 7 overview

Windows Phone 7

Contacts/Calendar

using Microsoft.Phone.UserData;

Get appoinments using Linq:

void Appointments_SearchCompleted(object sender, AppointmentsSearchEventArgs e) { try { AppointmentResultsDataLINQ.DataContext = from Appointment appt in e.Results where appt.IsAllDayEvent == false select appt; } catch (System.Exception) { //No results } }

59

Page 57: Windows phone 7 overview

Windows Phone 7

Media

60

Page 58: Windows phone 7 overview

Windows Phone 7

Media

You can use the following features to consume media in a Windows Phone application:

Use the MediaPlayerLauncher class for Windows Phone to embed audio or video using the device media player. Cf.

Launchers and Choosers chapter

Use the Silverlight MediaElement API to embed audio or video using a more customizable interface.

MediaElement for Windows Phone has a few differences than MediaElement for the desktop.

Add sound effects using XNA Game Studio.

Use the MediaStreamSource class for adaptive streaming solutions.

Use Microsoft.Phone.BackgroundAudio to create a media application that will continue playing audio when another

application is in the foreground. Cf. background agents chapter

61

Page 59: Windows phone 7 overview

Windows Phone 7

Media : MediaElement

<MediaElement Name="mediaElement1" Source="http://mschannel9.vo.msecnd.net/o9/mix/09/wmv/key01.wmv" AutoPlay="True"/>

mediaElement1.Play(); mediaElement1.Pause(); mediaElement1.Stop();

62

Page 60: Windows phone 7 overview

Windows Phone 7

Media : Integration with the music hub

63

Page 61: Windows phone 7 overview

Windows Phone 7

Media : Integration with the music hub

Your Music + Videos Hub application must conform to the Application Certification Requirements for Windows Phone to integrate with the Music + Videos Hub.

Tiles that are displayed in the Music + Videos Hub must conform to additional iconography rules:

You must include your application title or logo on each Tile.

The now playing Tile must be 358 pixels x 358 pixels. The file size must be 75 KB or less.

Other tiles must be 173 pixels x 173 pixels in size.

The Title property of the MediaHistoryItem class must be set to text that represents the content, such as a

station name or video title.

To help avoid confusion for users, Hub Tiles should not contain album art unless the album plays when the Hub

Tile is pressed.

If your application plays a stream, the Hub Tile graphic should describe the stream that is being played.

This is not a certification requirement, it is a good practice.

64

Page 62: Windows phone 7 overview

Windows Phone 7

Media : Integration with the music hub

Updating the 'now playing' Tile of the 'history' List

MediaHistoryItem mediaHistoryItem = new MediaHistoryItem(); //<hubTileImageStream> must be a valid ImageStream. mediaHistoryItem.ImageStream = <hubTileImageStream>; mediaHistoryItem.Source = ""; mediaHistoryItem.Title = "NowPlaying"; mediaHistoryItem.PlayerContext.Add("keyString", "Song Name"); MediaHistory.Instance.NowPlaying = mediaHistoryItem;

65

Page 63: Windows phone 7 overview

Windows Phone 7

Camera API

66

Page 64: Windows phone 7 overview

Windows Phone 7

Application Lifecycle Pre-Mango

Windows Phone supports programmatic access to the camera on a device, offering a rich

set of APIs for developers to create their applications.

Some features include: Creating a camera application with a viewfinder and capturing still photos

Providing real-time access to raw frames from the camera

Adjusting the resolution of the captured photo

Implementing functionality such as focus and flash

Detecting and querying the device camera capabilities such as flash

Accessing the camera hardware shutter button for capturing photos and triggering auto-focus

67

Page 65: Windows phone 7 overview

Windows Phone 7

Camera API

68

Page 66: Windows phone 7 overview

Windows Phone 7

Camera API

<Capability Name="ID_CAP_ISV_CAMERA"/> <Capability Name="ID_HW_FRONTCAMERA"/>

To use a camera in your Windows Phone application, you must add the

camera capability (ID_CAP_ISV_CAMERA) to the application manifest file.

69

Page 67: Windows phone 7 overview

Windows Phone 7

Conclusion

70

Page 68: Windows phone 7 overview

Any questions ?

71