DOC PREVIEW
Berkeley COMPSCI 160 - Smartphone Development Tutorial

This preview shows page 1-2 out of 5 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Smartphone Development Tutorial CS 160, March 7, 2006 Creating a simple application in Visual Studio 2005 and running it using the emulator 1. In Visual Studio 2005, create a project for the Smartphone platform (Smart DeviceÆWindows Mobile 5.0 Smartphone). To make deploying to the actual phone work, you should choose the “Device Application (1.0)” template. (The phone doesn’t have enough memory to install version 2.0 of the compact framework.) 2. Set the “Target device” to “Windows Mobile 5 Smartphone QVGA Emulator”. o Right-clicking your current application in the Solution Explorer, selecting “Properties”, and selecting the “Devices” tab. (The application is the second item on the list, not the top level ‘Solution’ entry.) o Change the target device using the drop-down menu. o Also uncheck the “Deploy the latest version of the .NET Compact Framework” checkbox. 3. By default, the “Device Application (1.0)” template includes a main form for your application, called Form1. Double-clicking “Form1.cs” in the Solution Explorer will open the form for editing. o Select the form by clicking on the picture of the phone in the main editor window o In the “Properties” panel at the bottom-right corner of the screen, find FormFactor and change the value to “Windows Mobile 5.0 Smartphone QVGA.” This will make the display of the phone the same size as the actual Smartphones used in class. 4. Drag some controls from the Toolbox (by default, hidden at the left side of the screen) onto the phone in the main editor window. 5. Under the “Debug” menu, select “Start Debugging.” This will bring up a dialog allowing you to select a deploy target – Pick “Windows Mobile 5.0 Smartphone Emulator QVGA” and click deploy. This will launch the emulator and launch your application. (Selecting “Debug” Æ “Stop Debugging” will quit your application but will leave the emulator running.) This process works fine for running applications from Visual Studio. But it doesn’t allow you to browse the file system on the emulator, which is necessary if you want to run the program manuallyor to manipulate files that the application creates on the phone. For that, you need to use ActiveSync. 1. Under “Tools” select “Device Emulator Manager” which opens the Manager. Scroll down the list of Emulated devices until you see “Windows Mobile 5.0 Smartphone QVGA Emulator” and select it. Now under the “Actions” menu in the Emulator manager, select “Cradle”. 2. Now open ActiveSync. Under “File” Æ “Connection Settings” check “Allow connections to one of the following” and select “DMA”. You only need to do this once. When you click “Connect”, ActiveSync should connect to the Emulator and give you some setup screens. After the first time, the connection should happen automatically when you “cradle” the Emulator via the Device Emulator manager. 3. Now you can browse the file system on the Emulator by selecting “Explore” on ActiveSync (or selecting “Mobile Device” from My Computer). By default, applications are deployed to “Program Files”. 4. To launch your application from the Start Menu of the Emulated device, select the executable (in “Program Files\[app name]”), and right click and select “Create Shortcut”. Right click on the shortcut and do “Cut”. Then navigate the Emulator File system to “\Windows\Start Menu\Debug Apps” and right click and do “Paste”. Now go to the Emulator. Open its start menu and scroll down to “Debug apps” and open it. You should find the app link in there, and selecting it will run your program. Running the application on a Smartphone Like most commercial Smart Phones, the SP5s have strong security protection by default. All the code that runs on the phone must be signed. The Smartphone SDK includes test signature certificates and programs. Unfortunately, the default security on the phone is too high to run even these. The first step is therefore to change the local security policy. You need a (signed) version of the Registry Editor to do this. 1. Configuring the Phone’s Security Policy WARNING: This requires a registry edit. We suggest this be done by a member of your group who has used a Windows registry editor before. If you’re unsure about this step, please bring the phone to us and we will make the edits. a. Copy the file regeditSTG.zip (http://inst.eecs.berkeley.edu/~cs160/sp06/readings/regeditSTG.zip) to your PC, and unzip it to produce regeditSTG.exe. Connect your Smartphone to the PC, and pair it with ActiveSync. Then click on “Explore” in ActiveSync to open the Smartphone’s file system. Browse to the \Program Files directory, and create a new folder called “Regedit”. Copy (drag and drop) the file regeditSTG.exe into this directory. b. You should then be able to browse to this directory from the phone itself. Click the start button on the phone, go down one screen to “File Manager”, and browse to \Program Files\Regedit. Click to start the registry editor. Once it starts, scroll to: HKEY_LOCAL_MACHINE\Security\Policies\Policies and then click on “Values”. You should see a list of Numerical key value names, starting with 00001001. Select 00001001 and change the “Value data” field to 1 (decimal). Click on Done.Exit the registry editor (red hangup button). This change allows the remote API (RAPI) tool to make further security changes. c. Now make sure that your device is connected to the PC with ActiveSync, and go to the Windows Mobile SDK directory on your PC (C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Smartphone SDK\Tools) and run: RapiConfig.exe /p SdkCerts.xml which makes various configuration changes to allow execution of Visual Studio apps on the phone. d. At this point you will be able to compile code from Visual Studio and deploy and run it on the Device. If the code is unsigned, you will get a security prompt the first time you run each program. To avoid this, you can configure Visual Studio to sign your application. 2. Configuring Visual Studio to sign your app a. In Visual Studio set “Target device” to “Windows Mobile 5.0 Smartphone Device”. b. From the “Project” menu, select “Properties”, then “Devices”. Select “Sign the project output with this certificate”. Then click on “Select CertificateÆManage CertificatsÆImport” to open the


View Full Document

Berkeley COMPSCI 160 - Smartphone Development Tutorial

Documents in this Course
E-LEAGUE

E-LEAGUE

15 pages

iCurator

iCurator

10 pages

Project

Project

14 pages

E-Drink

E-Drink

10 pages

Load more
Download Smartphone Development Tutorial
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Smartphone Development Tutorial and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Smartphone Development Tutorial 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?