windows phone concept - 7.1 & 8 preview

50
Windows Phone 技術分享 Pou Mason [email protected] http://www.dotblogs.com.tw/pou

Upload: pou-mason

Post on 07-Jul-2015

878 views

Category:

Technology


4 download

DESCRIPTION

介紹相關Windows Phone 7.1 SDK開發的概念與Windows Phone 8 SDK的Preview介紹。

TRANSCRIPT

Page 1: Windows Phone Concept - 7.1 & 8 Preview

Windows Phone

技術分享

Pou Mason

[email protected]

http://www.dotblogs.com.tw/pou

Page 2: Windows Phone Concept - 7.1 & 8 Preview

大綱

Windows Phone SDK 7.1

– Architecture

– Execution Model for Windows Phone

– Using Isolated storage

– Using Live Tile & Controls

– Chooser and Launcher

– Multitasking for Windows Phone

即將到來的Windows Phone 8

Page 3: Windows Phone Concept - 7.1 & 8 Preview

Windows Phone SDK 7.1

Page 4: Windows Phone Concept - 7.1 & 8 Preview

Concept

Windows Phone SDK 7.1 Architecture

Runtime, Tools, Cloud Services, Portal

Services

Application Development Lifecycle

Page 5: Windows Phone Concept - 7.1 & 8 Preview

Architecture – 1/2

Page 6: Windows Phone Concept - 7.1 & 8 Preview

Architecture – 2/2

Runtime

– Silverlight and the XNA Framework

Tools

– Visual Studio, Expression Blend

Cloud Services

– Windows Azure, XBOX Live, Notification

Services, and Location Services, …

Portal Services

– Windows Phone Marketplace

Page 7: Windows Phone Concept - 7.1 & 8 Preview

Runtimes

Page 8: Windows Phone Concept - 7.1 & 8 Preview

Application Development Lifecycle

Page 9: Windows Phone Concept - 7.1 & 8 Preview

Silverlight & XNA Framework

Silverlight

– 適用開發應用程式類的App,也可以開發遊戲

– WP與Windows在Silverlight的不同

• Implementation Differences Between Silverlight and

Silverlight for Windows Phone

XNA

– 適用開發遊戲與多媒體應用程式

究竟該開發那一種與選擇Framework• The Silverlight and XNA Frameworks for Windows

Phone

Page 10: Windows Phone Concept - 7.1 & 8 Preview

Execution Model – 1/6

Windows Phone應用程式的生命週期

類型

– Application State

– Application Events

– Page State

– Page Events

– Tombstoning

– State Dictionaries

Page 11: Windows Phone Concept - 7.1 & 8 Preview

Execution Model – 2/6

Application

– Data that is used by multiple pages in an

application.

Page

– The current visual state of a single application

page.

Application

PagePage Page

Page 12: Windows Phone Concept - 7.1 & 8 Preview

Execution Model – 3/6

Application Events

– Launching

– Deactivated

– Activated

– Closing

Page Events

– PhoneApplication Page

• OnNavigatedTo

• OnNavigatedForm

Page 13: Windows Phone Concept - 7.1 & 8 Preview

Execution Model – 4/6

Tombstoning (墓碑)

– 應用程式久未使用或被回收,非走Closing離開

程式,應用程式被視為墓碑

– App裡的所有資源被回收

Terminated (休眠)

– 應用程式從前景換到背景,未被回收時,視為休

眠模式 (或稱暫停)

– 資源仍存在,回到App時可以繼續使用

搭配Deactivated與ActivatedReference: Windows Phone 7 - 簡介新運作模式 - Dormant

Page 14: Windows Phone Concept - 7.1 & 8 Preview

Execution Model – 5/6

Deactivation

– 代表App將由前景轉換背景模式前的事件

– 保存Page或Application中必要的資料

Activation

– 代表App由背景轉換前景時的事件

• 背景轉前景與由Start再啟動App完全不同

– iOS / Android 二個視為相同

– 還原必要資料至Page或Application

Page 15: Windows Phone Concept - 7.1 & 8 Preview

Execution Model – 6/6

Application Lifecycle

(1)

(2)

(3)

(‘4)

(4)

(5’)

(5)

(6)

Page 16: Windows Phone Concept - 7.1 & 8 Preview

Page之間的切換 – Navigation – 1/2

PhoneAlicationFrame

– 一個Application有一個Frame

– 工作

• PhoneApplicationPage之間的資料交換

• 結合App.xaml控制ApplicationPage內的內容與控件

• 控制PhoneApplicationPage的切換

PhoneApplicationPage

– Application呈現的單位,UI控件的集合處

References: Navigation Framework原理概論

Page 17: Windows Phone Concept - 7.1 & 8 Preview

Page之間的切換 – Navigation – 2/3

關聯模塊

Page 18: Windows Phone Concept - 7.1 & 8 Preview

Page之間的切換 – Navigation – 3/3

Page切換原理

Page 19: Windows Phone Concept - 7.1 & 8 Preview

Isolated Storage – 1/3

Application專屬儲存區

– Sandbox機制,每個App具有獨立的I/O空間

– App之間無法交換資料

– 無法辦法直接訪問File System取得資料

– 提高安全性,降低未經授權的訪問和數據損壞的

可能性

Page 20: Windows Phone Concept - 7.1 & 8 Preview

Isolated Storage – 2/3

Data Storage Options

Page 21: Windows Phone Concept - 7.1 & 8 Preview

Isolated Storage – 3/3

Special-use Folders

– 也可依需求建立自訂的目錄結構

Path Use Note

Shared 管理Media、ShellContent與Transfer三個資料夾。

App安裝時自動建立,可

被刪除。

Shared/Media Album Art:App利用該資料夾呈現Album Art,配合Background Audio一起使用。

App安裝時自動建立,可

被刪除。常搭配多媒體應

用時,儲存媒體資料。

Shared/ShellContent Application Tiles: 用於呈現每個一

Tile在Font/Back的底層資訊,配合Live Tiles時使用。

App安裝時自動建立,可

被刪除。配合Live Tiles時使用。

Shared/Transfer Background file transfer:用於存放背景下載的檔案,配合

Background Transfer元件使用。

App安裝時自動建立,可

被刪除。配合BackgroundTransfer元件使用。

Page 24: Windows Phone Concept - 7.1 & 8 Preview

Local Database – 2/2

Supported Properties

– data source : isostore/appdata

– password : 40 characters

• AES-128, SHA-256

– max buffer size: 384~5120 (kilobytes)

– max database size: 32~512 (megabytes)

– mode

• read write/read only/exclusive/shared read

Page 25: Windows Phone Concept - 7.1 & 8 Preview

Live Tile – 1/3

Tile

– WP獨特的概念元素,可呈現App資訊、互動項

目與通知內容

– 搭配Push Notification、Schedule排程等,動態

的調整Tile的內容

– Tile的動態特效,由系統控制,到了WP8有更豐

富的呈現機制

Page 27: Windows Phone Concept - 7.1 & 8 Preview

Live Tile – 3/3

修改Tiles的機制

– ShellTile APIs

• Application Tile and Secondary Tiles can be created,

updated, and deleted

– Tile Notifications

• Tile properties can be updated by using the Microsoft

Push Notification Service

– ShellSchedule APIs

• The background images on the front of a Tile can be

updated on a recurring schedule, even if your

application is not running.

Page 28: Windows Phone Concept - 7.1 & 8 Preview

Controls & Toolkits

Controls

– Supported Controls in Windows Phone

Silverlight for Windows Phone

– Silverlight for Windows Phone Toolkit

Unsupported controls

– ComboBox, TreeView, OpenFileDialog, …

Page 30: Windows Phone Concept - 7.1 & 8 Preview

MultiTask – 1/2

Background Agent

– 獨立於App之外的特殊背景元件

• 建置時屬於不同的專案

– Android, iOS中不具有該類項目,但各自有對應的背景機制

– 與App之間無法直接溝通

• 統一透過Isolated Storage進行資料交換

Lifecycle

– 一個App只有一個Agent

– NotifyComplete(), Abort()

– ScheduleToast

Page 31: Windows Phone Concept - 7.1 & 8 Preview

MultiTask – 2/2

Background Transfer

– 提供佇列一至多個檔案在背景下進行上傳、下載

Background Audio

– 支援App在非前景下仍可以播放音樂

Background Schedule Tasks

– 支援安排App在背景時可以處理特定的任務

• Periodic Task

– 適用執行較短時間的任務,執行隔間具有規律週期性

• Resource-intensive Task

– 適用需要執行較長時間的 任務,只有設備在指定狀況下使用

Page 32: Windows Phone Concept - 7.1 & 8 Preview

Application Features

Application Features for Windows Phone

– Application Bar

– MusicHub, Picture Hub

– Contacts and Calendar

– Location, Media

– Push Notification

– …

Page 35: Windows Phone Concept - 7.1 & 8 Preview

功能特性一覽表

New platform & APIs

Multi-resolution

Speech

Tile and Notifications

Lock Screen

In-app purchasing

Proximity, Bluetooth, Wallet extensibility

Page 36: Windows Phone Concept - 7.1 & 8 Preview

Introduction

WP8

– 採用與Win 8相同的Runtime,並增加更豐富支

援手機應用與硬體整合的APIs

• Win8:WinRT

• WP8:WinPRT

– 支援COM、Win32 APIs

– 不支援

• Javascript直接存取WinRT APIs

Page 37: Windows Phone Concept - 7.1 & 8 Preview

WinRT vs. WinPRT

綠色代表相同的,白色代表新增加的部分,只適用於WP8中的WinPRT

Page 38: Windows Phone Concept - 7.1 & 8 Preview

Multi-resolution – 1/2

WVGA, XVGA, 720p

– WP7.1的App需要重新調整Layout佈局

• XVGA, 720p更要小心處理

Page 39: Windows Phone Concept - 7.1 & 8 Preview

Multi-resolution – 2/2

Page 40: Windows Phone Concept - 7.1 & 8 Preview

Speech

互動方式

– Voice Commands

• 透過語音指令deep-link應用程式

– 可自訂的指令語言

– Speech Recognition & Text-to-Speech APIs

• 透過語音進行輸入,以及讀出用戶輸入的文字

– 利用基於雲計算的語音識別網絡搜索和聽寫,或建立更複雜

的互動

Page 41: Windows Phone Concept - 7.1 & 8 Preview

New Tiles – 1/3

Flip Tile Template

Page 42: Windows Phone Concept - 7.1 & 8 Preview

New Tiles – 2/3

Cycle Tile Template

– Describes a tile template that cycles between 1

to 9 background images.

Page 43: Windows Phone Concept - 7.1 & 8 Preview

New Tiles – 3/3

Iconic Tile Template

Page 44: Windows Phone Concept - 7.1 & 8 Preview

Lock Screen

Lock screen background image

– a user can choose to use an app as its lock

screen background provider

Lock screen notification Area

– provide content on the lock screen

• App icon (24x24 pixel)

• App count

• App text

References: 偷看Windows Phone 8 Emulator的內容

Page 45: Windows Phone Concept - 7.1 & 8 Preview

In-app purchasing – 1/3

Overview

Page 46: Windows Phone Concept - 7.1 & 8 Preview

In-app purchasing – 2/3

Develop provide

– products that can be sold in your app

– clear and accurate product information

– the ability to initiate a purchase from within your

app, that is, a “buy button”

– product delivery and/or enablement, also known

as fulfillment

Page 47: Windows Phone Concept - 7.1 & 8 Preview

In-app purchasing – 3/3

Microsoft provide:

– product management tools through App Hub

– geo-distributed services

– a purchase user experience that is consistent

across all apps on the phone

– the ability to pay you in 190 countries or regions

– proof of purchase authenticity through secure

receipts

Page 48: Windows Phone Concept - 7.1 & 8 Preview

Proximity & Bluetooth

Proximity

– establish a connection between your app and

another instance of your app on another,

nearby, phone.

• NFC

Bluetooth

– enable apps to communicate over Bluetooth.

Using this API, an app can connect to another

app, or to a device

Page 49: Windows Phone Concept - 7.1 & 8 Preview

Wallet extensibility

Store payment instructions, deals, and

loyalty cards.

Manage the payment instruments that they

use in the app and music store.

Link items in the wallet to apps on their

phone.

Make contactless transactions, using near

field communication (NFC), in certain

markets.

Page 50: Windows Phone Concept - 7.1 & 8 Preview

Q & AThanks for your listening