Click here to Skip to main content
Click here to Skip to main content
Go to top

An Introduction to Microsoft SmartPhone, and Programming SmartPhone using C#

, 3 Oct 2004
Rate this:
Please Sign up or sign in to vote.
The objective of this article is to provide the prelude to beginners of SmartPhone programming. This article provides introduction to SmartPhone, its features, and APIs. Also, the article discusses on creating a simple program using C# for the SmartPhone.

Introduction

The objective of this article is to provide the prelude to the beginners of SmartPhone programming. This article provides introduction to SmartPhone, its features and APIs. Also, the article discusses on creating a simple program using C# for the SmartPhone.

In recent days, mobility is getting its momentum and attention both from the public consumers of mobile services and major corporations of the world. Mobility today equips knowledge workers with the power to access information and data from any part of the world.

As any other rapid technology evolution, mobility has certainly evolved and its recent form is on Mobile Phones, but be sure that, this mobility would create a whole new world and accessories useful for mankind, starting from a lay man to the richest. And it is also true that soon mobility would take another form and shape, and would become part of our lives.

Fine… But what do I get as a developer on all these happening around me… Actually, there is a whole new exciting world opened up for developers which is definitely a paradigm shift from today’s Desktop and Web Application development. New technology, new challenges, new opportunities, and… new way to earn… $ Money $ Wink | ;-)

Mobility Evolution

As part of the evolution, we had various handheld devices, Pocket PCs, PDAs et al. Today’s mobility world is trying to gain advantage by leveraging advantages of successful cellular phones which are truly mobile and is owned by people of all sectors of the world.

There have been various models of phones available in today’s market. As of today, the market is ruled by Symbion OS embedded on the Nokia Phones and other proprietary phones like Sony, Samsung et al.

Much like the Web Browser market, Microsoft is a bit late to enter the mobile world. Today Microsoft has its own proprietary operation system, called as Microsoft Windows Mobile 2003, powered by the strong WinCE 4.2 OS. These phones with the Microsoft OS is slowly capturing up the market, and the developers' world.

As always, Microsoft provides adequate developer support to program these phones using existing languages and technologies. Microsoft .NET Compact Framework, a subset of the rich .NET Framework, does this magic. One great news is that the .NET CF runtime is now preloaded on the ROM of the Microsoft, which definitely eases the burden during the application deployment.

Features

Microsoft SmartPhone is loaded with a very rich suite of software, which communicates to the user through Voice, Text and Internet capable applications, by leveraging the connectivity options like GSM, GPRS, SMS, PPTP, Bluetooth, USB, and Infrared IrDA.

Following is the comprehensive list of software usually loaded along with the Microsoft SmartPhone.

Pocket Internet Explorer No more plain vanilla WAP Browser on phones, instead a full blown IE 5 is loaded on the phones supporting HTML 3.2, XML, XSL, cHTML, WAP 1.2.1, WML Script, Active Script, ActiveX, SSL, JPEG, GIF etc.
Pocket Outlook With tools for contacts, calendar, email, tasks and voice notes. Along with support for IMAP4, POP3 and SMS.
MSN Messenger A full blown messenger
Microsoft ActiveSync Supports Server and Desktop synchronization.
Windows Media Player Plays MP3, WMA, AVI
Voice Notes To quickly record voices
Games Variety of Mobile games.
File Management Utilities File Manager [like Windows Explorer], Task Manager
Wireless Modem Options to connect through USB, IR, COM
MMS Client Send and receive MMS messages
Camera Camera support for image capture and video capture

SmartPhone Layout

Microsoft has suggested a standard layout and control structure for the devices. [Ref: SmartPhone SDK]

The placement of soft keys, the Home key, the Back key, and the five-way navigation pad illustrated in the preceding figure is strongly recommended. All the hardware controls (soft keys, and so on) must be present; however, a device manufacturer is free to deviate from the design.

Recently, Microsoft launched the Microsoft Windows Mobile 2003 Second Edition, and the following developer tools are available, based on its open Win32 development environment and an SDK for SmartPhone [can be downloaded].

  • Embedded VC++ 4.0
  • Visual Studio .NET – C#, VB.NET

A Simple Hello World Program

Now, let’s get into business. Let us write a simple Hello World program. The first and foremost activity we need to do for programming the SmartPhone using Visual Studio 2003 is to download the SmartPhone 2003 SDK. Upon installing the SDK, the smart device extensions are extended with support for SmartPhone development along with the SmartPhone emulator.

After the SDK is installed, launch Visual Studio, choose Smart Device Application under project templates, and give a name for your application, and click OK. Now, you should see a screen as below:

Choose SmartPhone and Windows Application as depicted above, and hit the OK button. Now, you should see your favorite Visual Studio geared up for SmartPhone development.

On the Toolbox, you can see a list of controls, and some familiar controls are disabled, these disabled controls are not supported on the SmartPhone.

Now, we have to employ a goody good practice for SmartPhone development. We need to consider that the phones are usually operated using a single hand, therefore the navigability of the applications you create should be easy. The “Softkey” depicted on the layout plays a role here. If you closely observe VS, you might notice a default Menu control is created for you. It suggests you to use MainMenu, which would become the default navigation keys to navigate your application using the soft keys of the mobile phone.

So, let us create a menu structure as below:

Double click on the “Say Hello” MenuItem and write the following code:

private void menuItem2_Click(object sender,System.EventArgs e)
{
     MessageBox.Show("Hello Logu!");
}

And write the following code for the Exit menu:

private void menuItem3_Click(object sender, System.EventArgs e)
{
    this.Close();
}

Now, hit F5 to run the application, a new popup would request you choose the device to target, choose “Smartphone 2003 Emulator (Virtual Radio) (Default)”, and hit “Deploy”.

Now the emulator should load up, and the application would be deployed to the emulator, and a prompt would appear as below:

Click OK to continue to launch the application.

Now, your .NET application is loaded on the SmartPhone. After the application is launched, click “My Menu” and click “Say Hello”, you should see the alert message now… That’s it. Now, you can choose the target as SmartPhone device and deploy directly to your SmartPhone device also. Packaging and deployment is not discussed in this article as that would itself be another full article.

APIs

Following is the list of API's available for SmartPhone development:

  • ActiveSync API
  • Bluetooth API
  • CE Messaging API
  • Device Management API
  • Home Screen API
  • Object Exchange (OBEX)
  • Pocket Outlook Object Model (POOM)
  • Speech Recognizer
    • Telephony - TAPI
    • Accessing the SIM card
    • P/Invoke to native SIM Toolkit APIs
  • RAPI – Remote API to connect to the desktops programmatically
  • GAPI – To develop Mobile games
  • Vibrate API
  • Voice Recorder Controls

Don't you think the SmartPhone is already powered up for today's Enterprise?

I strongly suggest you to read SmartPhone SDK documentation before diving into SmartPhone application development.

The world is not limited with this… but grows indefinitely.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Logu Krishnan
Web Developer
India India
No Biography provided

Comments and Discussions

 
Generalsmartphone bluetooth Pinmembersumeet.sum1016-Sep-09 1:49 
GeneralMy vote of 1 PinmemberDeep Ash25-Jun-09 12:45 
General[Message Deleted] Pinmemberit.ragester28-Mar-09 5:39 
GeneralPushing the video stream to the Server PinmemberHarshil_Gunchala30-Jan-09 19:57 
GeneralWindows Mobile Video Capture Frames Pinmembersherinsabry25-Jun-08 23:38 
Generalsmartphone software radio PinmemberEngineer Masood23-Apr-07 20:39 
QuestionHow to store data in a Smartphone application Pinmembergonzamol30-Jul-06 16:15 
GeneralModem AT Commands Pinmemberrtleo30-Jul-06 2:46 
GeneralBeginner Pinmemberletter_only3-Jun-06 16:41 
GeneralRe: Beginner Pinmemberletter_only6-Jun-06 1:23 
Generalhelp! Pinmembertienvanphan22-May-06 1:36 
QuestionHow to access smartphone file system programatically with C# Pinmemberdaniel.zolnjan14-May-06 0:02 
GeneralUsing C# for Building Smartphone 2003 mobile applications Pinmemberpmvinay24-Apr-06 18:08 
QuestionRe: Using C# for Building Smartphone 2003 mobile applications Pinmemberhamid_m23-May-06 23:14 
GeneralWinCE 5.0 PinmemberDevil Hill26-Feb-06 20:43 
QuestionWSE Component Pinmembervenugopal.10@indiatimes.com19-Jan-06 21:12 
GeneralPackiging Pinmemberbasheer_massarani29-Dec-05 22:52 
GeneralI couldn't run my program PinmemberTuyen Tran13-Oct-05 19:14 
GeneralError after put menu ctrl PinmemberRuwan S12-Oct-05 21:30 
Hi,
This is a very good sample for newbie. My app doesn't work after I put menu control. It throws exception on "Me.Menu = Me.MainMenu1" line. Anybody have idea about this error. If I remove menu it works fine.
 
Your help greately appreciated,
 
Regards,
 
Ruwan
Cry | :((
Generalreading Sim card information Pinmemberkapil_montu7-Sep-05 8:13 
QuestionHow to Attach a Jpeg Img Pinmembervivekthangaswamy19-Aug-05 2:03 
AnswerRe: How to Attach a Jpeg Img PinmemberSantos Das17-Jul-07 17:47 
GeneralMaintaining Session in SmartPhones Pinmemberharidask@info-spectrum.com14-Jun-05 19:00 
GeneralMMS Pinmemberwaelahmed12-May-05 15:48 
Questionhow install smartphone sdk or embedded vc++ PinsussAnonymous27-Apr-05 23:52 
AnswerRe: how install smartphone sdk or embedded vc++ PinmemberRuwan131-Jul-08 20:31 
QuestionRe: how install smartphone sdk or embedded vc++ Pinmemberme_project18-Jan-09 19:42 
GeneralAmazing One PinsussBhavini14-Apr-05 1:33 
Generalvoice mail PinsussAnonymous8-Mar-05 23:26 
QuestionSystem.NotSupportedException - why? PinsussAnonymous27-Jan-05 14:32 
AnswerRe: System.NotSupportedException - why? PinmemberChris Sells28-Jan-05 7:40