Maarten Struys Windows Mobile Evangelist Alten-PTS Session Code: MOB201-SUN Agenda Introduction Creating a Windows Mobile Application Testing Windows Mobile Applications Data on the Device Making use of Device.

Download Report

Transcript Maarten Struys Windows Mobile Evangelist Alten-PTS Session Code: MOB201-SUN Agenda Introduction Creating a Windows Mobile Application Testing Windows Mobile Applications Data on the Device Making use of Device.

Maarten Struys
Windows Mobile Evangelist
Alten-PTS
Session Code: MOB201-SUN
Agenda
Introduction
Creating a Windows Mobile Application
Testing Windows Mobile Applications
Data on the Device
Making use of Device Capabilities
Battery Friendly Development
Conclusion
Introduction
Developing Windows Mobile Applications
Use the same development tools as desktop
developers
There are a few challenges
Slower processors
Battery powered devices
User Interface restrictions
Device Security
Application installation and execution
Encryption of data, devices can ‘easily’ be lost
Introduction
Windows Mobile
One brand name for a wide variety of devices
Windows Mobile 6 Standard (Smart Phone)
Windows Mobile 6 Professional (Pocket PC)
Software Development Tools
Visual Studio 2005 Professional or better
Support for Native and Managed applications
.NET CF 1.0 and .NET CF 2.0 support
Visual Studio 2008 Professional or better
.NET CF 3.5 and .NET CF 2.0 support
Introduction
Installing the Windows Mobile 6 SDKs
To develop applications for WM 6 devices you
need to install the WM 6 SDK’s
Separate downloads for Standard and Professional
Integrate seamlessly in Visual Studio 2008
You can also download Windows Mobile 6.1
emulator images to target newer Devices
To develop for Windows Mobile 6.5 also install the
Windows Mobile 6.5 DTKs
Introduction
Using the Development Tools
Developer experience identical for Desktop and
Windows Mobile applications
Fewer UI controls available
Fewer API’s available
Target the .NET Compact Framework
Highly compatible subset of the full .NET Framework
Target Platform differs from Development Platform
Developing Applications
Challenges
Dealing with different devices, different screen
sizes and different hardware
Creating effective user interfaces
Synchronizing data with desktops / servers
Network connections
Battery life
Targeting Different Devices
Device Emulator is your Friend
Why use the emulator to begin with?
Allows targeting a large range of devices
without having access to physical devices
Allows testing cellular connections without
needing a costly physical connection
Allows easy testing of different security
scenarios
Creating your first Windows Mobile App
Hello World in C++, C# and Visual Basic.NET
Testing your Application
Unit Testing for Devices
Unit Testing is a procedure used to validate that
individual pieces of source code are working
properly
A Unit is the smallest testable part of code
In C# and VB.NET methods inside classes
Calling methods with different parameters and examining
return values
Unit Tests are typically written by the developer
Testing your Application
Creating Unit Tests
Unit Tests can be generated automatically or
created manually
The latter makes sense for Test Driven
Development
They will exist in a separate test project
You can target both the .NET CF 2.0 and the
.NET CF 3.5
Need at least Visual Studio 2008 Professional
Testing your Application
Executing and Retrieving Results
Unit Tests are started on the development
machine but will execute on the device
Test results are displayed inside Visual Studio
Tests can be executed from inside Visual Studio
2008 or from a Command Prompt making use of
mstest.exe
Creating and Running Device Unit Tests
Storing Data on the Device
Planning ahead is Important
No application exists without data
Consider your data needs during design
Using unstructured data?
Providing my own data store functionality?
Using a real database on the device?
How about synchronization to a back-end server?
Storing Data on the Device
Two ‘popular’ approaches
Using XML files
True platform independence
Good support in managed code with DataSet.ReadXml and
DataSet.WriteXml
Overhead because of XML
Using SQL Server 2005 CE
Great performance
Use existing SQL Server skills
Design the database on the desktop
Needs the .NET Compact Framework 2.0
Does not run on every device
Storing Data on the Device
Typed DataSet
In memory representation of a database
Manipulate data as a small relational database
Save or load contents to XML
Save or load contents to SQL Server Mobile or from
remote server
Receive populated datasets from Web Service
Pass datasets to Web Service
Storing Data on the Device
SqlCeResultSet
Provides direct connectivity to the SQL Server
Mobile Edition database
Supports forward and backward scrolling
Supports updates
Supports databinding
Storing Data on the Device
Synchronization with Backend Servers
Microsoft SQL Server 2005 / 2008
(Express Editions supported)
Visual Studio 2008 (SP1)
Microsoft SQL Server Compact 3.5 (SP1)
Microsoft Synchronization Services for
ADO.NET 1.0
Using SQL Server CE
Device Capabilities
Using already installed functionality
Windows Mobile Devices come with a lot of
software already pre-installed
Pocket Outlook
Office Mobile
Internet Explorer
Windows Media Player
The Windows Mobile 6 Managed SDK exposes
some of this functionality to application
developers
Device Capabilities
Managed APIs to access Pocket Outlook
Wraps POOM
Using and managing Personal Information
Manager items inside your own application
Contacts, Appointments, and Tasks
E-mail, SMS and MMS
Consistent interface to access information
Device Capabilities
Pocket Outlook Classes
Device Capabilities
The Gateway to your Device
Look at Microsoft.WindowsMobile namespace
Collection of classes, enumerations, and delegates
Ships as part of the Windows Mobile 6.0 SDK
Provide functionality for managed developers
Application and platform level APIs
More control of the device in managed code
Supplement existing libraries
No part of the.NET Compact Framework
Device Capabilities
Making Phone Calls
Two lines of code to make a phone call
Phone phone = new Phone();
phone.Talk(“123-456-7890”);
Making use of Device Capabilities
Battery Friendly Development
Introduction
Windows Mobile devices are very powerful
However, they are useless with empty batteries
Decreasing the used power means increasing
the battery life
Don’t do anything unless it is absolutely
necessary!
Battery Friendly Development
Be a Good Citizen (1)
When interacting with the user, an application is
free to consume as much as necessary
Reducing the “necessary” amount is what performance
optimization is all about
In the background, it should consume very little
memory, and ZERO battery power
If all applications behave correctly, user
satisfaction increases for each application and
for Windows Mobile as a whole
Battery Friendly Development
Be a Good Citizen (2)
Don’t use the processor
Disable radio’s when not needed
Absolutely don’t use the processor when the
application is in the background
Don’t use polling at any time
Limit application functionality when the battery
level is low
Don’t keep the backlight on
Battery Friendly Development
Device Differences
Windows Mobile Standard
Device can either be on or off
When off nothing works
Windows Mobile Professional
Device can be in suspend mode (sleep)
Separate state between on and suspend, called
unattended
When the device seems off it is probably asleep
Be Friendly to the Device Battery
Session Summary (1)
Developing applications for Windows Mobile
Devices is as easy as developing desktop
applications
However ….
You have to deal with different form factors
You should develop battery friendly applications
Install the Windows Mobile 6 SDK’s
Make use of Unit Testing and the emulator to
test your apps
Session Summary (2)
SQL Server CE is a great database to store data
locally and to synchronize with servers
Re-use existing functionality on the device
Access device hardware through the managed
API’s that are part of the Windows Mobile SDKs
Take a look at the sample code in the SDKs to
get started yourself
Resources
www.microsoft.com/teched
www.microsoft.com/learning
Sessions On-Demand & Community
Microsoft Certification & Training Resources
http://microsoft.com/technet
http://microsoft.com/msdn
Resources for IT Professionals
Resources for Developers
Related Content
MOB01-IS - Windows Mobile Tips and Tricks for Developers
MOB03-IS - Performance Optimization and Power Management for Windows Mobile
Devices
MOB05-IS - Come Meet the Windows Mobile Team!
MOB307 Introducing the patterns & practices Mobile Application Blocks
Complete an evaluation
on CommNet and enter to
win an Xbox 360 Elite!
© 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should
not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS,
IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.