30
Mobile Development Microsoft Mobile Platforms Rob Miles Department of Computer Science

Introduction to mobile platforms

Embed Size (px)

Citation preview

Page 1: Introduction to mobile platforms

Mobile Development

Microsoft Mobile Platforms

Rob MilesDepartment of Computer Science

Page 2: Introduction to mobile platforms

Introduction

A bit of history> Where the Pocket PC came from> Where the Smartphone came from> Pocket PC Phone Edition

At bit of architecture> How the platforms run the programs> Why managed code is wonderful

A bit of construction> The tools you will need

Page 3: Introduction to mobile platforms

Pocket PC

Originally called the “wallet PC”

Launched in 1996 with Version 1.0 of Windows CE

Superseded in the following year with Version 2.0

Initially available in keyboard and keyboard-less versions

Page 4: Introduction to mobile platforms

Breakthrough Pocket PC:Compaq Ipaq

This was the first device to deliver on performance, display and battery life

> 120MHz processor

> 32MB of RAM

> Flash ROM

> RS232 and IR ports

> 240x320 TFT colour display

Page 5: Introduction to mobile platforms

State of the art Pocket PC

Dell Axim V50s> 624Mhz Processor> 64MB RAM> 480x640 colour display> WIFI and Bluetooth> 3D Graphics accelerator

Windows Mobile 5 upgradeable £150 less than the original

IPAQ!

Page 6: Introduction to mobile platforms

Smartphone

In 2001 Microsoft announced that it would be launching a range of Smarpthones (codenamed "Stinger")

The Smartphones would be "Windows based"

The version of Windows in question was Windows CE 3.0

Launched in October 2002 with Orange SPV

Page 7: Introduction to mobile platforms

Breakthrough Smartphone:SPV E200

First to deliver on performance and battery life:

> 32MB user memory> Built in Bluetooth support> Built in camera > Smartphone 2003 Operating System> .NET Compact Framework

Page 8: Introduction to mobile platforms

State of the art Smartphone: SPV C500

Launched in August 2004> 64MB of internal memory> Fast internal processor (200 MHz)> Small form factor > Runs Windows Mobile 2003

Second Edition

Being replaced by the C550 which adds Media Player 10 for protected content

Page 9: Introduction to mobile platforms

Pocket PC Phone Edition

Combines PDA with phone> Launched in July 2002> 206-MHz Intel StrongArm

processor> 32MB RAM> Based on Pocket PC 2002

Page 10: Introduction to mobile platforms

Breakthrough Device: XDA II

Launched in April 2004> 400MHz Processor> 128MB RAM> Camera> Bluetooth> Windows Mobile 2003

Page 11: Introduction to mobile platforms

State of the Phone Edition:XDA IIS

Launched in April 2005> Integrated Keyboard> Improved performance

Page 12: Introduction to mobile platforms

What you should be saving up for….

First 3G Windows Mobile Device

> Branded as Orange M5000> VGA resolution display

(640x480)> WIFI support> Two cameras> Windows Mobile 5.0

Want one

Page 13: Introduction to mobile platforms

Other devices of note

Gizmondo> Offers a Windows CE based gaming

platform with GPS, GPRS and 3D Acceleration built in

> Licensed developers only (sadly)

Imate JAM> Very small Pocket PC phone edition> New form factor for Pocket PC

Page 14: Introduction to mobile platforms

The Future…

The development of the devices over the last few years has been amazing

The systems are going to get more powerful and more connected

Location based behaviour is now very easy to implement in systems

Page 15: Introduction to mobile platforms

Architecture

If you write programs for the mobile devices you should plan to work in the Compact Framework using “managed” code

This makes your programs> Portable> Safe> Easy to write

Page 16: Introduction to mobile platforms

Managed and Native Code

Managed Code User Program

.NET Compact Framework

Class Libraries

.NET Compact Framework Common Language Runtime

Processor and Operating System Services

Native (Unmanaged Code) User Program

Page 17: Introduction to mobile platforms

Native (unmanaged) code

Programs are compiled to machine code for the target processor

Created in C++ or Visual Basic and compiled for the specific hardware in the device

Has direct access to the processor instruction set

Scary stuff for uber-geeks

Page 18: Introduction to mobile platforms

Managed Code

Programs execute within a managed environment

Microsoft Intermediate Language (MSIL) is Just In Time compiled on the target device

Code is not produced for a specific target hardware

Code is validated before execution

Helps programmers sleep at night

Page 19: Introduction to mobile platforms

Managed Code is Best

You should concentrate on managed code development

> it is easier and faster to create

> programs are inherently more reliable and easier to debug

However, we need to be aware that there is a performance penalty for working this way

> the first time a method is called the run time system must "Just In Time" compile the MSIL code for that method into machine code

> this can lead to delays when programs start up and, sometimes during execution when new classes are loaded

Page 20: Introduction to mobile platforms

Inside a Managed Code Program

Because the executable is a .NET program you can use ILDASM and other tools to manipulate it

You could even create MSIL applications for mobile devices if you wish

Page 21: Introduction to mobile platforms

P/Invoke is your friend

If you need to get “down and dirty” from managed code you use Platform Invoke (P/Invoke)

This provides marshalling of data to and from calls to native methods

You will use this to access some parts of the operating system the Compact Framework cannot reach:

> Device Data: Battery Life etc

> Placing Calls and SMS messages

Page 22: Introduction to mobile platforms

So, Rules To Code By

Use Managed Code wherever possible Good reasons to use Native Code:

> You *really* want speed> You *really* want to drive the hardware directly> You are being paid *really* large sums of money to do it

Compromise> If you need native code, put it in a native code library and

then talk to it via the Platform Invoke (P/Invoke) mechanism

Page 23: Introduction to mobile platforms

Writing the Code

You can use C# if you like (in fact I insist) You can use Visual Studio A lot of the forms behaviours map directly

across to the mobile platform You do not need a real device

> Unless you want to place phone calls or send/receive SMS messages

Page 24: Introduction to mobile platforms

Visual Studio 2003

Visual Studio 2003 as supplied will develop managed code applications for the Pocket PC

By adding the Smartphone Developer kit to Visual Studio 2003 you can use this to develop Smartphone applications

The Smartphone Developer Kit is a free download, but you need to have Visual Studio to make use of it

Page 25: Introduction to mobile platforms

Visual Studio 2005

This is a significant advance over Visual Studio 2005

The Forms editor now functions with a more complete emulation of the mobile device display

The emulation of the devices is now at processor level rather than an 8086 version of the device

You can pick up Beta 2 for free!

Page 26: Introduction to mobile platforms

Deploying the Program

When the program is executed from within Visual Studio it is copied into a directory on the target device and executed from there

You can deploy the program just as an executable file if you wish, by copying it into a directory on the Smartphone using the ActiveSync

Or you can build an installer

Page 27: Introduction to mobile platforms

Debugging

The debug tools are very powerful You can:

> Pause an executing program> Add a breakpoint to an executing program without stopping it

These facilities work on the target device too You must however have used Debug mode to

build the application The Remote Display Power tool can be useful

here

Page 28: Introduction to mobile platforms

Finding the Program

The more recent mobile phones are shipped with file browser programs you can use to find and run the executable directly

Pocket PC owners can use the built in file browser

Page 29: Introduction to mobile platforms

Developers Toolkits…

To start to develop you need: Visual Studio 2003

> Active Sync. 3.7 or better> Smartphone 2003 tools

Visual Studio 2005> Active Sync. 4.0

Powertoys> You should also get the Power Toys

Page 30: Introduction to mobile platforms

Call to Action

The devices out there are getting really powerful and connected

They are about as easy to write for as desktop machines

This is a genuinely new area where the scope for innovation is huge

So get out there and get started!