Android ios wp7

Preview:

DESCRIPTION

 

Citation preview

So sánh phát triểnứng dụng trên iOS, Android

và Windows Phone 7

cuong@microsoft.com

Tại sao không viết một app để chạy được trên cả nhiều hệ điều hành: iOS, Android và Windows Phone 7, …

Lợi:- Tăng xác suất tải về trên cả 3 hệ điều hành.- Tăng mức độ phổ biến – khả năng tương thích. Hài lòng

các fan của iOS lẫn Android lẫn Windows Phone.- Tận dụng lại ý tưởng hay, tài nguyên (hình ảnh, video,

âm thanh, mã logic…)

Khó khăn:- Cần thành thạo cả 3 OS- Time to market có thể giảm- Tối ưu cho từng OS là khác nhau

Có bao nhiêu cách ?

1. HTML 5- CSS3-JavaScript: PhoneGap, jQueryMobile, jQTouch, Sencha Touch,….

2. Appcelerator’s Titanium Mobile: converts JavaScript to symbolic files then compile to native apps

3. Porting apps: reuse code/ resource , modify code to adapt to each platform.

Source : PhoneGap

JavaScriptJavaScriptHTML,

JavaScript, CSS

UI + Logic

UI API Phone API

JavaScript to Objective-C bridge

Native iOS App

iOS Objective-C

UI + Logic

UI API Phone API

JavaScript to Java bridge

Native Android App

Android Java

UI API maps to native UI components: NavBar, Tabbar, Toolbar, Menu, Dialogs, Alert, Button, List…

Phone API maps to phone features: Geo, Accelerometer, Maps, Sound, Video, Database, File IO, Network…

Cách cổ điển porting app vẫn cần thiết bởi vì:

1- Tối ưu cao nhất cho từng hệ điều hành – thiết bị cụ thể.

2- Cần tối ưu tốc độ ứng dụng.

3- Cần nâng cao trải nghiệm giao diện người dùng.

Nắm vững lập trình trên một

hệ OS

Tìm ra điểm chung với các hệ OS còn lại

Quy trình phát triển ReusablePorting

Optimize và test trên từng

OS

TRƯỚC KHI SO SÁNH IOS, ANDROID VÀ WINDOWS PHONE 7….

HÃY XEM WINDOWS PHONE 7 NHƯ THẾ NÀO.

Cấu hình phần cứng

Phân giải màn hình480x800 QVGA320x480 HVGA

Cảm ứng đa điểm4 or more contact points

Chụp ảnh5 mega pixels or moreDedicated camera button

Nút bấm vật lýStart, Search, Back

Cảm biếnA-GPS, Accelerometer, Compass

GPUDirectX 9 acceleration

CPUARMv7 Cortex/Scorpion or better1G

Bộ nhớ256MB RAM or more8GB Flash or more

MultimediaCommon detailed specsCodec acceleration

800

480

Consistent Platform

Windows Phone

Hardware

Common Hardware Elements

Quality Focus

Microsoft chuẩn hoá yêu cầu phần cứng:1- Tăng chất lượng ứng dụng

2- Giảm tối đa lỗi không tương thích và thời gian kiểm thử

Phiên bản Windows Phone 7.5 “Mango” kế tiếp có thể khác !

Phát triển ứng dụng cho WP7

High performance game framework

Rapid creation of multi-screen 2D and 3D games

Rich content pipeline

Mature, robust, widely adopted technology

Xbox 360, Windows, and Zune

Modern application UI framework

Rapid creation of visually stunning apps

Metro-themed UI controls

HTML/JavaScript

500,000 developers spanning Windows and web

IOS, ANDROID VÀ WINDOWS PHONE 7

Hardware Closed Open Standardized

Brother devices IPad / IPad2 Honey Comb

Tablet XBox360

Market AppStore Android Market MarketPlace

Program Language Objective C / C Java C#, VB.net, VB

Virtual Machine None Dalvik .NET CLR

Browser Engine

Mobile SafariWebKit

ChromeWebKit

Internet ExplorerTrident

UI Framework Cocoa Touch Java App

Framework SilverLight

CORE OS kernel, file, network, security, power, device drivers

CORE Services string, collection, network, contact, GPS, compass, accelerometer, gyroscope

MEDIA CoreGraphics, Text, OpenGL ES, Core Animation, AVFoundation, Core Audio, video

Cocoa Touch UIKit, Animation, Multitasking, Gesture Recognizers, PushNotification

Objective-C Apps HTML 5, CSS, JavaScript Apps

Customed UI No Yes, HTC Sense… Yes, Sense UI, …

Keyboard Virtual Virtual + Physical Virtual + Physical

Flash No Yes No

SilverLight No No SilverLight 3.0 mobile

Music Stores Itunes 3rd parties Zune

Games AppStore 3rd parties XBoxLive

Default Search SpotLight Search in OS. Google for Web Google Bing

Threadedmail Mail App Gmail Outlook mobile

Copy & Paste Yes Yes No Do Update

Dev tools XCode Ecllipse Visual Studio 2010

Dev enviroment Leopard Snow on Apple or Intel

Windows, Linux, Mac Windows

Debug real time Yes Yes Yes

3D OpenGL ES OpenGL ES DirectX

Garbage collection

Optional. Need to enable by compiling directive

By default By default

Game Library Cocos2D AndEngine XNA

Push Notification Yes Yes Yes

Local Storage File I/O + Preference File I/O + Preference

Isolated Storage + Preference

Local Database SQLite SQLite SQLite porting

Dev tools XCode Ecllipse Visual Studio 2010

Dev enviroment Leopard Snow Windows, Linux, Mac Windows

Debug real time Yes Yes Yes

3D OpenGL ES OpenGL ES DirectX

Garbage collection

Optional. Need to enable by compiling directive

By default By default

Game Library Quartz, Cocos2D AndEngine, … XNA, …

XML Yes Yes Yes + LINQ

Local Storage File I/O + PreferenceSQLite

File I/O + Preference

Isolated Storage + Preference

Local Database Default SQLite Default SQLite NA but can use ported SQLite

Multithread NSThread Async Task Yes

Multitasking From iOS4 Yes for internal services. Mango

Push Notification Yes Yes Yes

RESTful service Yes Yes Yes + Odata API

Cloud Ready Unknown Google Aps Windows Azure

Location based Google Map Google Map Bing (Google Map)

Multi-tasking on single core

Operating System

CPU Core

Internal Service 1 Internal Service 2 App 1App Service

Background Foreground

Multi-tasking on dual core

Operating System

CPU Core 1

Internal Service 1 Internal Service 2 App 1App Service

CPU Core 2

Background Foreground

Multi-threading

Operating System

CPU Core 1

Internal Service 1 Internal Service 2

CPU Core 2

Background

Foreground

Data Processing

Complextask

User Interface

Windows Phone 7 (2010) không hỗ trợ ứng dụng hãng thứ 3 multi tasking.

Windows Phone 7 (Mango) hỗ trợ multi tasking.

Garbage Collection

• Disable by default

• Enable by compiler switch

• When GC is not available alloc/release/aurorelease

• CFRetain/CFRelease

• Automatic by default

• Rely too much on GC will deperformance your app

http://wp7mapping.interoperabilitybridges.com

API API

Lập trình UI Android khá giống WP7

• Vẽ giao diện bằng XML hoặc tạo động bằng code.

• Hứng sự kiện trong XML hoặc trong code

• Di chuyển giữa các trang• Menu bar – Application bar• Cách kích hoạt các tác vụ và nhận giá

trị trả về

App.xaml

Frame / Page

Launcher Chooser

Controls

Notification

XML, LINQ, OData

System Tray (title, progress bar)

Application Bar (menu button)

Page

Standard Controls

Customed Controls

3rd Party Controls

DEMO MỘT SỐ ỨNG DỤNG WP7

Communication Service

• Location aware service• Push notification• SOAP / REST / WCF / OData

Odata – WCF Client

Tham khảo• http://blog.radvision.com/voipsurvivor/2010/10/07/ios-android-windows-phone-7

-and-the-great-changes-in-the-operating-systems-market/

• http://www.slideshare.net/dtmilano/android-development-tutorial-v3

• http://msdn.microsoft.com/en-us/library/ff431744(v=vs.92).aspx (WP7 Code Example)

• http://create.msdn.com/en-US/education/catalog/ (WP7 Content Example)

• http://www.pcworld.com.vn/articles/san-pham/phan-mem/2011/03/1224409/cuoc-chien-he-dieu-hanh-di-dong-android-ios-va-windows-phone/ (Cuộc chiến hệ điều hành di động: Android, iOS và Windows Phone)

• http://windowsphone.interoperabilitybridges.com/ (WP7 cho iPhone developers)

• http://channel9.msdn.com/posts/Minh-Tran-TranCreative-Experience-developing-for-Windows-Phone-7

• http://www.msdev.com/Default.aspx

Recommended