C # getting started with developing a smartphone Program

Source: Internet
Author: User

Prepared by Li Ning

  Introduction

This article aims to guide beginners of smartphone programming into the smartphone world and learn how to use C # To write a smartphone program. This article first introduces what is smartphone and some features of smartphone and APIs for programming. To better understand how to use C # To write a smartphone program, this article also provides an example of a simple smartphone program written using C, you can use this example to quickly learn how C # is used to write programs for smartphone.

Recently, mobile This emerging field is being moved Users of mobile devices and some world-class companies are following and seeking for them. Move now Mobile devices use advanced information access and retrieval technologies. Mobile devices access any corner of the world. Mobile devices will make people more powerful.

Just like the rapid development of any other technology Mobile devices are also developing rapidly. You can say for sure, shift Mobile devices will create a new world, whether it's civilians or rich people. Mobile devices will become a good helper for them. It may appear in other forms in the near future. Mobile devices will become part of your life.

It's amazing that developers can do the work at hand... In fact, they can fully enter an exciting and exciting world, in which traditional desktop and web development are revolutionized. In this world, there are new technologies, new challenges, and new opportunities. Of course, more importantly, there are new ways to earn money... $ Money $.

  Shift Development of Mobile Devices

Shift The development of mobile devices has become rich and colorful today, and now we have a variety of mobile devices. You can choose between mobile devices, such as handheld devices, Pocket PCs, and PDAs. Move now Mobile devices are attempting to take advantage of the advantage that mobile phones have been widely used by people around the world.

Today's shift The mobile phone market already has a variety of models to choose from. At present, the mobile phone market has been monopolized by Nokia, Sony, Samsung and other companies that use the symbion operating system.

Microsoft is moving It is too late to move the world. Today, Microsoft already has its own It is Microsoft Windows mobile2003, and more powerful wince4.2. Mobile phones using Microsoft operating systems are encroaching on market share, and more developers are turning to the Microsoft camp.

According to Microsoft's consistent practice, Microsoft provided corresponding support to developers immediately after introducing the corresponding mobile phones and operating systems, this includes developing software for Microsoft mobile phones using existing languages. Because Microsoft currently promotes. NET Framework, it is necessary to enable. NET Framework to run on a mobile phone. Considering the hardware environment of mobile phones, Microsoft has launched a. NET Framework Lite version, which is a subset of the. NET Framework on a PC.

  Features

Microsoft's smartphone has a wealth of software that allows users to communicate with each other through sound, text, and the Internet (such as GSM, GPRS, SMS, PPTP, and Bluetooth.

The following is a list of software installed by Microsoft smartphone.

Pocket Browser This browser is much more powerful than the WAP browser, and it can completely replace ie5. This browser supports html3.2, XML, XSL, chtml, wap1.2.1, WML script, active script, ActiveX, SSL, JPEG, and GIF.
Pocket Outlook Similar to outlook on a PC, this tool can manage contacts, diaries, task management, and recording audio, as well as send and receive emails.
MSN Messenger A chat client is similar to MSN Messenger on a PC.
Microsoft ActiveSync Synchronize the client and server
Windows Media Player A media player that supports MP3, WMA, and AVI playback.
Voice notes A recording software.
Games Some games.
File Management utilities File and task management, similar to Windows File Manager.
Wireless modem You can connect to the Internet through USB, IR, and COM.
MMS Client Receive MMS information.
Camera A video collection software that allows you to record and capture videos.

  Smartphone appearance

Figure 1 shows the standard appearance and control panel of the mobile device recommended by Microsoft.


Figure 1 standard smartphone Interface

The console has two soft keys, one home key, one back key, and five direction keys. The following are ten numeric keys and the keys "*" and. Microsoft strongly recommends this key structure. Among these keys, all control keys (such as soft and home keys) are required. However, these devices are not made by Microsoft, but by manufacturers of large and small mobile devices. Therefore, the appearance and structure of these devices may differ from that recommended by Microsoft.

Microsoft recently released the second version of Windows Mobile 2003. developers can select the following development tools to develop software for Windows Mobile. These software are based on Win32 and Microsoft. NET Compact framework.

1. Embedded VC ++ 4.0
2. Visual Studio. NET-C #, VB. NET
A simple hello World Program

Now let's go to the topic and develop a simple hello World Program. The first thing to do to write this program is to download the smartphone2003 development package that can be run in visual studio2003. After the development kit is installed, the development environment of smartphone and a smartphone simulator have been installed on your machine.

After installing the SDK, start Visual Studio, select the smart device application in the Project template, give it a name, and click OK. Now, you will see the welcome page 2.


Figure 2 welcome page of smart phone

Select smartphone and Windows application, and click OK. Now you will see the development interface shown in 3.


Figure 3 development interface of smartphone

On the toolbar on the right, you can see a control panel. There are some familiar controls on this panel, but these controls are unavailable, this is because smartphone does not support these controls.

Now we can develop the smartphone application. We should first consider that the mobile phone usually only uses one hand, so the application's navigation key should be easy to operate. The "soft" key on the mobile phone usually acts as the navigation key. If you observe Visual Studio carefully, you can notice that Visual Studio has created a default Menu Control for us. Visual Studio recommends that we use this mainmenu control, which will eventually become a navigation key to control our smartphone application.

Now, let's create a menu structure as shown in Figure 4:


Figure 4 smartphone menu

Double-click the "Say hello" menu to write the Execution Code:

Private void menuitem2_click (Object sender, system. eventargs E)
{
MessageBox. Show ("Hello logu! ");
}

The code for the "exit" menu is as follows:

Private void menuitem3_click (Object sender, system. eventargs E)
{
This. Close ();
}

Press F5 to run the program. A dialog box 5 is displayed, which allows you to run the program on which device you want to use. Choose "Smartphone 2003 emulator (virtual radio) (default) ", and then click" deploy"


Figure 5 select a running device dialog box

Now the simulator has been started, as shown in interface 6. Our application has been installed on the simulator. A prompt is displayed on it, and an "OK" is displayed in the lower left corner ".


Figure 6 Simulator

Click "OK" to run our program.

Now our. Net program is running. After the application is running, click "Say hello" in "my menu", and you will see the Information Box 7. Now, you can select a smartphone device and publish the program directly to the device. Since packaging and publishing do not belong to the content of this article, we will not discuss it here.


Figure 7 program running interface

  APIS supported by smartphone

The following lists the APIS supported by smartphone.

· ActiveSync API
· Bluetooth APIs
· Ce messaging API
· Device Management APIs
· Home screen API
· Object Exchange (obex)
· Pocket outlook Object Model (poom)
· Speech recognizer
O telephony-TAPI
O accessing the SIM card
O p/invoke to native SIM toolkit APIs
· Rapi-Remote API to connect to the specified tops programmatically
· Gapi-to develop mobile games (API for Game Development)
· Vibrate API
· Voice recorder controls (API for recording)

Original article: http://db.cinews.net/n/200610/26/n20061026_76356.shtml

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.