Click here to Skip to main content
15,868,113 members
Articles / Programming Languages / C#

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

Rate me:
Please Sign up or sign in to vote.
2.80/5 (22 votes)
3 Oct 2004CPOL6 min read 243K   92   46
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 $ ;-)

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 ExplorerNo 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 OutlookWith tools for contacts, calendar, email, tasks and voice notes. Along with support for IMAP4, POP3 and SMS.
MSN MessengerA full blown messenger
Microsoft ActiveSyncSupports Server and Desktop synchronization.
Windows Media PlayerPlays MP3, WMA, AVI
Voice NotesTo quickly record voices
GamesVariety of Mobile games.
File Management UtilitiesFile Manager [like Windows Explorer], Task Manager
Wireless ModemOptions to connect through USB, IR, COM
MMS ClientSend and receive MMS messages
CameraCamera support for image capture and video capture

SmartPhone Layout

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

Image 1

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:

Image 2

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.

Image 3

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:

Image 4

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

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

And write the following code for the Exit menu:

C#
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”.

Image 5

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

Image 6

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.

Image 7

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)


Written By
Web Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
Generalsmartphone bluetooth Pin
sumeet.sum1016-Sep-09 1:49
sumeet.sum1016-Sep-09 1:49 
GeneralMy vote of 1 Pin
Deep Ash25-Jun-09 12:45
Deep Ash25-Jun-09 12:45 
General[Message Deleted] Pin
it.ragester28-Mar-09 5:39
it.ragester28-Mar-09 5:39 
GeneralPushing the video stream to the Server Pin
Harshil_Gunchala30-Jan-09 19:57
Harshil_Gunchala30-Jan-09 19:57 
GeneralWindows Mobile Video Capture Frames Pin
sherinsabry25-Jun-08 23:38
sherinsabry25-Jun-08 23:38 
Generalsmartphone software radio Pin
Engineer Masood23-Apr-07 20:39
Engineer Masood23-Apr-07 20:39 
QuestionHow to store data in a Smartphone application Pin
gonzamol30-Jul-06 16:15
gonzamol30-Jul-06 16:15 
GeneralModem AT Commands Pin
rtleo30-Jul-06 2:46
rtleo30-Jul-06 2:46 
GeneralBeginner Pin
letter_only3-Jun-06 16:41
letter_only3-Jun-06 16:41 
GeneralRe: Beginner Pin
letter_only6-Jun-06 1:23
letter_only6-Jun-06 1:23 
Generalhelp! Pin
tienvanphan22-May-06 1:36
tienvanphan22-May-06 1:36 
QuestionHow to access smartphone file system programatically with C# Pin
siliconesoul14-May-06 0:02
siliconesoul14-May-06 0:02 
GeneralUsing C# for Building Smartphone 2003 mobile applications Pin
pmvinay24-Apr-06 18:08
pmvinay24-Apr-06 18:08 
QuestionRe: Using C# for Building Smartphone 2003 mobile applications Pin
hamid_m23-May-06 23:14
hamid_m23-May-06 23:14 
GeneralWinCE 5.0 Pin
Devil Hill26-Feb-06 20:43
Devil Hill26-Feb-06 20:43 
QuestionWSE Component Pin
venugopal.10@indiatimes.com19-Jan-06 21:12
venugopal.10@indiatimes.com19-Jan-06 21:12 
GeneralPackiging Pin
basheer_massarani29-Dec-05 22:52
basheer_massarani29-Dec-05 22:52 
GeneralI couldn't run my program Pin
Tuyen Tran13-Oct-05 19:14
Tuyen Tran13-Oct-05 19:14 
GeneralError after put menu ctrl Pin
Member 221421512-Oct-05 21:30
Member 221421512-Oct-05 21:30 
Generalreading Sim card information Pin
Member 21822597-Sep-05 8:13
Member 21822597-Sep-05 8:13 
QuestionHow to Attach a Jpeg Img Pin
vivekthangaswamy19-Aug-05 2:03
professionalvivekthangaswamy19-Aug-05 2:03 
AnswerRe: How to Attach a Jpeg Img Pin
Santos Das17-Jul-07 17:47
Santos Das17-Jul-07 17:47 
GeneralMaintaining Session in SmartPhones Pin
Harisri14-Jun-05 19:00
Harisri14-Jun-05 19:00 
GeneralMMS Pin
waelahmed12-May-05 15:48
waelahmed12-May-05 15:48 
Hi Thank you for intersting article

can you help me please to find out how to read MMS inbox


BR
Wael
Questionhow install smartphone sdk or embedded vc++ Pin
Anonymous27-Apr-05 23:52
Anonymous27-Apr-05 23:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.