windows phone concept - 7.1 & 8 preview
DESCRIPTION
介紹相關Windows Phone 7.1 SDK開發的概念與Windows Phone 8 SDK的Preview介紹。TRANSCRIPT
大綱
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
Windows Phone SDK 7.1
Concept
Windows Phone SDK 7.1 Architecture
Runtime, Tools, Cloud Services, Portal
Services
Application Development Lifecycle
Architecture – 1/2
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
Runtimes
Application Development Lifecycle
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
Execution Model – 1/6
Windows Phone應用程式的生命週期
類型
– Application State
– Application Events
– Page State
– Page Events
– Tombstoning
– State Dictionaries
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
Execution Model – 3/6
Application Events
– Launching
– Deactivated
– Activated
– Closing
Page Events
– PhoneApplication Page
• OnNavigatedTo
• OnNavigatedForm
Execution Model – 4/6
Tombstoning (墓碑)
– 應用程式久未使用或被回收,非走Closing離開
程式,應用程式被視為墓碑
– App裡的所有資源被回收
Terminated (休眠)
– 應用程式從前景換到背景,未被回收時,視為休
眠模式 (或稱暫停)
– 資源仍存在,回到App時可以繼續使用
搭配Deactivated與ActivatedReference: Windows Phone 7 - 簡介新運作模式 - Dormant
Execution Model – 5/6
Deactivation
– 代表App將由前景轉換背景模式前的事件
– 保存Page或Application中必要的資料
Activation
– 代表App由背景轉換前景時的事件
• 背景轉前景與由Start再啟動App完全不同
– iOS / Android 二個視為相同
– 還原必要資料至Page或Application
Execution Model – 6/6
Application Lifecycle
(1)
(2)
(3)
(‘4)
(4)
(5’)
(5)
(6)
Page之間的切換 – Navigation – 1/2
PhoneAlicationFrame
– 一個Application有一個Frame
– 工作
• PhoneApplicationPage之間的資料交換
• 結合App.xaml控制ApplicationPage內的內容與控件
• 控制PhoneApplicationPage的切換
PhoneApplicationPage
– Application呈現的單位,UI控件的集合處
References: Navigation Framework原理概論
Page之間的切換 – Navigation – 2/3
關聯模塊
Page之間的切換 – Navigation – 3/3
Page切換原理
Isolated Storage – 1/3
Application專屬儲存區
– Sandbox機制,每個App具有獨立的I/O空間
– App之間無法交換資料
– 無法辦法直接訪問File System取得資料
– 提高安全性,降低未經授權的訪問和數據損壞的
可能性
Isolated Storage – 2/3
Data Storage Options
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元件使用。
Isolated Storage vs. XAP
Isolated Storage
– App安裝後所產生的儲存區
XAP Resource
– XAP為App實際安裝檔
• 與Android中的Assets相似
– 可在應用過程裡,直接將XAP中的資訊Copy至Isolated
Storage進行操作
– XAP裡的資料是不可以修改
– XAP中的資料隨著專案打包時
• Content 與 Resource包裝上的差異
Reference: Windows Phone 7 – TitleContainer.OpenStream與App.GetResourceStream - 讀取XAP內資源的方法
Local Database – 1/2
Architecture
– DataContext
• 輕量的Entity Framework
– 沒有工具,要描述一個DB,全部要手動建立
– LINQ to SQL Runtime
• 所有的交易一律透過OR Mapping,沒有SQL
References: Windows Phone 7 – Local Database概論 - 2
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
Live Tile – 1/3
Tile
– WP獨特的概念元素,可呈現App資訊、互動項
目與通知內容
– 搭配Push Notification、Schedule排程等,動態
的調整Tile的內容
– Tile的動態特效,由系統控制,到了WP8有更豐
富的呈現機制
Live Tile – 2/3
Application Tile
– The font of a tile
– Only one
Secondary Tiles
– The back of a tile
– User can custom
References: Windows Phone 7 - 學習新的Secondary Tile與Application Tile
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.
Controls & Toolkits
Controls
– Supported Controls in Windows Phone
Silverlight for Windows Phone
– Silverlight for Windows Phone Toolkit
Unsupported controls
– ComboBox, TreeView, OpenFileDialog, …
Chooser & Launcher
Launchers and Choosers Overview for
Windows Phone
Chooser
– 呼叫系統內部應用程式,並有回傳值
– Choosers for Windows Phone
Launcher
– 呼叫系統內部應用程式,執行固定任務
– Launchers for Windows Phone
References: Windows Phone 7 - 更多元的Microsoft.Phone.Tasks
MultiTask – 1/2
Background Agent
– 獨立於App之外的特殊背景元件
• 建置時屬於不同的專案
– Android, iOS中不具有該類項目,但各自有對應的背景機制
– 與App之間無法直接溝通
• 統一透過Isolated Storage進行資料交換
Lifecycle
– 一個App只有一個Agent
– NotifyComplete(), Abort()
– ScheduleToast
MultiTask – 2/2
Background Transfer
– 提供佇列一至多個檔案在背景下進行上傳、下載
Background Audio
– 支援App在非前景下仍可以播放音樂
Background Schedule Tasks
– 支援安排App在背景時可以處理特定的任務
• Periodic Task
– 適用執行較短時間的任務,執行隔間具有規律週期性
• Resource-intensive Task
– 適用需要執行較長時間的 任務,只有設備在指定狀況下使用
Application Features
Application Features for Windows Phone
– Application Bar
– MusicHub, Picture Hub
– Contacts and Calendar
– Location, Media
– Push Notification
– …
References
Gesture Support for Windows Phone
Performance Considerations in Applications
for Windows Phone
Code Samples for Windows Phone
Windows Phone Training Course
Windows Phone Development QuickStarts
Mobile Platform Development
Windows Phone 8
即將到來
偷看Windows Phone 8 Emulator的內容
功能特性一覽表
New platform & APIs
Multi-resolution
Speech
Tile and Notifications
Lock Screen
In-app purchasing
Proximity, Bluetooth, Wallet extensibility
Introduction
WP8
– 採用與Win 8相同的Runtime,並增加更豐富支
援手機應用與硬體整合的APIs
• Win8:WinRT
• WP8:WinPRT
– 支援COM、Win32 APIs
– 不支援
• Javascript直接存取WinRT APIs
WinRT vs. WinPRT
綠色代表相同的,白色代表新增加的部分,只適用於WP8中的WinPRT
Multi-resolution – 1/2
WVGA, XVGA, 720p
– WP7.1的App需要重新調整Layout佈局
• XVGA, 720p更要小心處理
Multi-resolution – 2/2
Speech
互動方式
– Voice Commands
• 透過語音指令deep-link應用程式
– 可自訂的指令語言
– Speech Recognition & Text-to-Speech APIs
• 透過語音進行輸入,以及讀出用戶輸入的文字
– 利用基於雲計算的語音識別網絡搜索和聽寫,或建立更複雜
的互動
New Tiles – 1/3
Flip Tile Template
New Tiles – 2/3
Cycle Tile Template
– Describes a tile template that cycles between 1
to 9 background images.
New Tiles – 3/3
Iconic Tile Template
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的內容
In-app purchasing – 1/3
Overview
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
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
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
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.
Q & AThanks for your listening