MBL202 Introduction to Microsoft® Windows® Powered Smartphone Development Neil Enns.

48
MBL202 Introduction to Microsoft® Windows® Powered Smartphone Development Neil Enns
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    217
  • download

    0

Transcript of MBL202 Introduction to Microsoft® Windows® Powered Smartphone Development Neil Enns.

MBL202

Introduction to Microsoft® Windows® Powered Smartphone Development 

Neil Enns

Overview

Smartphone hardware

Smartphone software

Development environment

Working with telephony

Application security & certification

Community resources

Smartphone 2002 HardwareWork with great hardware partners

HTC

Compal

Samsung

Mitac

Asus

Drive innovationConcept design with Intel

Reduce hardware requirements

Smartphone 2002 Hardware120MHz ARM processor

16MB+ RAM for application execution and temporary storage

32MB flash ROM for OS and permanent data storage

176x220 16-bit colour display

Storage and Memory

ROM (~24MB)Permanent content from Microsoft, OEM, and Operator provided applications.

Can be updated over-the-air.

RAM (~16MB)Application execution and radio.

Cleared on power off and reboot.

Flash (~8MB)Permanent data storage for application data, registry, and files, and databases.

Survives power loss, reboots, etc.

User InterfaceUser Interface

Smartphone User Interface

Simple, one-handed operation

Everything is full screen

Menu items minimisedReduce feature set to core elements users need on these devices

Eliminate complexity

Everything is a listLists simplify screen display and ease localisation to non-English languages

Smartphone User Interface

No touch screen

Navigation via a 5-way controllerScrolling and soft keys instead of tapping

Minimise application “depth”

Text inputPrimarily through T9 and other keyboard-based systems

Minimise text input wherever possible

Smartphone 2002Smartphone 2002

demodemo

Screen shots and information from theScreen shots and information from thedemo are available in the appendixdemo are available in the appendix

Smartphone Development Smartphone Development EnvironmentEnvironment

Development Environment

eMbedded Visual C++ 3.0

Smartphone 2002 SDK Plug-in

Includes emulation environmentUse Wavecom radio for wireless connectivity

Ethernet network connectivity is another option

Available for free at www.microsoft.com/mobile/developer/

Development Kit

A real handset!

Test SIM

Smartphone 2002 SDK

T-shirt & watch

Available to members of our Mobile Solutions Partner Program

eVC 3.0 and eVC 3.0 and Smartphone EmulatorSmartphone Emulator

demodemo

Useful Code SamplesUseful Code Samples

Finding the Persistent Storage Path

To persist data, it must be stored in the registry or under in persistent storage directory

Use SHGetSpecialFolderPath() for root pathCSIDL_APPDATA\<appname> for files internal to your app

CSIDL_PERSONAL for files the user needs to work with (“My Documents”)

Data stored in RAM file system will be lost on power off

Finding the Persistent Storage Path

TCHAR szVolumeFile[MAX_PATH];

if(!SHGetSpecialFolderPath(NULL, szVolumeFile, CSIDL_APPDATA, TRUE))

{ASSERT(FALSE);

hr = HRESULT_FROM_WIN32(GetLastError());

return 0;

}

Creating Softkeys and Handling Back

Softkeys are just PocketPC menu bars that only have two items

Send a message to the menu bar to request messages for the back key

Remember to #define TPC so SHNavigateBack() works

Creating Softkeys and Handling Back#define TPC

//Create a MenuBarSHMENUBARINFO mbi;memset(&mbi, 0, sizeof(SHMENUBARINFO));mbi.cbSize = sizeof(SHMENUBARINFO);mbi.hwndParent = hParent;mbi.nToolBarId = IDM_MAIN_MENU;mbi.hInstRes = g_hInst;mbi.nBmpId = 0;mbi.cBmpImages = 0;

// Create the menu barif (!SHCreateMenuBar(&mbi)){

MessageBox(hParent, TEXT("SHCreateMenuBar Failed"), TEXT("Error"), MB_OK);return false;

}

Creating Softkeys and Handling Back

// Request notifications for the back keySendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK,

MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY, SHMBOF_NODEFAULT | SHMBOF_NOTIFY));

Creating Softkeys and Handling Back

// Handle the back key in the main window procLRESULT CALLBACK MainWndProc(HWND hWnd, UINT uMessage,

WPARAM wParam, LPARAM lParam){

switch (uMessage){

…case WM_HOTKEY:{if((VK_TBACK == HIWORD(lParam)) && (MOD_KEYUP &

LOWORD(lParam))) {

// Process back keyreturn 0;

}}

}}

Voice Calls

Based on TAPI, with extensions for GSM-specific functionality

One simple API to make a voice calltapiRequestMakeCall

Voice Calls Example 1

#include <astdtapi.h>

LONG result;

result = tapiRequestMakeCall(TEXT(“+18005551212”), NULL, NULL, NULL);

if (result != 0){    // Insert error handling code here}

Voice Calls Example 2

#include <phone.h>

PHONEMAKECALLINFO mci;FOO result;

memset(&mci, 0, sizeof(mci));mci.cbSize = sizeof(mci);mci.dwFlags = SHMCF_PROMPTBEFORECALLING ;mci.pszDestAddress = TEXT(“+18005551212");

result = PhoneMakeCall(mci);if (result != 0){    // Insert error handling code here}

Data Calls

All data calls are requested through Connection Manager

Connection Manager takes care everything

All connections are made to networks“The Internet”

“My Corporate Network”

Not the same thing as Connection Manager on your PC!

It’s simpler for end users

Data Calls

WorkWorkWorkWork InternetInternetInternetInternet

ProxyProxy

VPNVPN

RED-MSG-42RED-MSG-42

http://msw/http://msw/

www.microsoft.comwww.microsoft.com

Microsoft Dial-upMicrosoft Dial-up Operator GPRSOperator GPRS

Data Calls Example

Shows how to establish a data connection to The Internet

Could be GPRS, Dial-Up, Ethernet, etc.

Connection Manager will decide

Does not open a TCP/IP socketAdditional code is required to do this after the call is established

Data Calls Example, Part 1

#define INITGUID

#include <connmgr.h>

CONNMGR_CONNECTIONINFO connInfo;

HANDLE hConnection;

SIM Manager Example

Simple APIs for accessing records and phonebooks on the SIM

Notifications available for detecting SIM changes

SIM Manager Example, Part 1

#include <simmgr.h>

HRESULT result = S_OK;HSIM hSim;SIMPHONEBOOKENTRY phonebookEntry;

result = SimInitialize(0, NULL, NULL, &hSim);if (result != S_OK){

// Handle error here}

SIM Manager Example, Part 1

result = SimReadPhonebookEntry(hSim, SIM_PBSTORAGE_SIM, 42, &phonebookEntry);

if (result != S_OK){

// Handle error here}

// Do something with the phone book entry hereresult = SimDeinitialize(hSim);if (result != S_OK){

// Handle error here}

Things to Keep in Mind

Background tasks suck battery lifeWhen your application loses focus shut off your timersThis has a significant impact on battery life

Exit menu items aren’t necessaryThe shell will notify you when memory conditions are low and you should shut down

Home should always go homeTrapping the home key prevents phone calls

Application Signing & Application Signing & CertificationCertification

Application Signing

On Smartphone, security policy may require that applications be signedWhich certificates are on the device?

Mobile2MarketMobile Operator

How is security policy configured?OPEN – most applications don’t need signingLOCKED – applications need signing

Application Logo Certification

Logo program that is separate from signing

Certification is not required for an application to be signed

Consists of UI guidelines and requirements to ensure application quality

More information is available at http://www.microsoft.com/mobile/developer/developerprograms/mobile2market/join.asp

Next StepsNext Steps

Ask The ExpertsGet Your Questions Answered

I will be available in the Ask The Experts area any time I am not presenting a session

Come see me!

Community ResourcesCommunity ResourcesAsk your questions on our newsgroups:

Microsoft.public.smartphone

Microsoft.public.smartphone.developer

Check out our website for developers:http://smartdevices.microsoftdev.com/

Check out our MVP site for developers:http://www.smartphonedn.com

Visit the Windows Mobile™ Community:http://www.microsoft.com/windowsmobile/community/

evaluationsevaluations

© 2003 Microsoft Corporation. All rights reserved.© 2003 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.

AppendixAppendix

Content covered during the deviceContent covered during the devicedemonstrationdemonstration

Smartphone Hardware

SendSend EndEnd

KeypadKeypad

SoftkeysSoftkeys

Smartphone Hardware

4-way 4-way navigationnavigation

BackBack

ActionAction

HomeHome

Smartphone Customization

Home screens

Color schemes

Ring tones (WAV and MIDI)

Softkeys

Left softkey is most common action

Right softkey is a menuItems are listed in desktop-style order

Items never have ellipses (…)

Dialogs have “Done” on the left softkey and “Cancel” on the right (if necessary)

Edit Controls

Edit controls support multiple input methodsTypically the methods available will be numeric, multi-tap, and T9

Multi-line edit controls support zooming in for a larger view

Spinner Control

Replaces combo boxes, radio buttons, and list boxes

Multi-item selection available

Typical Application Flow

List view -> card view -> edit view

Contacts is a classic example

© 2003 Microsoft Corporation. All rights reserved.© 2003 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.