Mobile Development
Microsoft Mobile Platforms
Rob MilesDepartment of Computer Science
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
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
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
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!
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
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
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
Pocket PC Phone Edition
Combines PDA with phone> Launched in July 2002> 206-MHz Intel StrongArm
processor> 32MB RAM> Based on Pocket PC 2002
Breakthrough Device: XDA II
Launched in April 2004> 400MHz Processor> 128MB RAM> Camera> Bluetooth> Windows Mobile 2003
State of the Phone Edition:XDA IIS
Launched in April 2005> Integrated Keyboard> Improved performance
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
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
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
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
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
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
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
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
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
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
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
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
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
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!
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
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
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
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
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!