1 / 39

Windows Mobile v.5.0 New Features for Developers

Windows Mobile v.5.0 New Features for Developers. Larry Lieberman Program Manager Mobile & Embedded Devices Microsoft Corporation. Agenda. What is Windows Mobile version 5.0? What is new for developers? What is the new developer toolset? . Windows Mobile 5.0 Focus. Increased productivity

wheaton
Download Presentation

Windows Mobile v.5.0 New Features for Developers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Windows Mobile v.5.0New Features for Developers Larry Lieberman Program Manager Mobile & Embedded Devices Microsoft Corporation

  2. Agenda • What is Windows Mobile version 5.0? • What is new for developers? • What is the new developer toolset?

  3. Windows Mobile 5.0 Focus • Increased productivity • Integrated multimedia • More opportunities for differentiation

  4. Windows Mobile 5.0 Devices HTC Universal Samsung Flextronics

  5. Developer Focus

  6. Mobile DirectX • Native port from Windows DirectX API • Fast API ramp-up • Large existing support base • .NET CF v2 subset of managed D3D, use: Microsoft.WindowsMobile.DirectX.Direct3D • Fast and easy 3D development with no plumbing • Requires Windows Mobile v5 • Samples in Windows Mobile 5 SDK & in Visual Studio documentation. Most run in the emulator • Mobile DirectX support is required in Windows Mobile 5 hardware

  7. OutlookSession Properties return appropriate folder value OutlookSession os = new OutlookSession(); Folder contactFolder = os.Contacts;

  8. Folders and Collections Items propertiesreturn appropriatePimItemCollection OutlookSession os = new OutlookSession(); int contactCount = os.Contacts.Items.Count;

  9. Appointments, Contacts, & Tasks OutlookSession os = new OutlookSession(); Contact c = new Contact(); c.FullName = “Larry Lieberman”; o.Contacts.Items.Add(c); c.JobTitle = “Program Manager”; c.Update();

  10. Appointments & Tasks: Recurrence t = (Task)this.comboBox1.SelectedItem; label2.Text = Convert.ToString(t.IsRecurring); if (t.IsRecurring) { label4.Text =Convert.ToString(t.RecurrencePattern.RecurrenceType); }

  11. Custom PIM Properties NOTE: will not sync with Exchange accounts Contact myCustomer; // ... if(!myCustomer.Properties.Contains(“Employee ID”)) { myCustomer.Properties.Add("Employee ID",typeof(string)); } myCustomer.Properties["Employee ID"] = "ABC1234";

  12. Initiate Calls with Phone.Talk Dim phone As New Phone phone.Talk(“425-555-0101”,False)

  13. Sending E-mail & SMS SmsMessage msg; msg.To.Add(new Recipient(“555- 5309")); msg.Body = “Hello World!"; msg.Send();

  14. Contacts Are Not Recipients Contact myCustomer; // ... EmailMessage msg = new EmailMessage(); msg.To.Add(myCustomer); // This won’t compile! msg.To.Add(new Recipient(myCustomer.Email2Address));

  15. Attach Files to E-mail Messages OutlookSession os = new OutlookSession(); EmailMessage msg = new EmailMessage(); Attachment at = new Attachment(“\Stuff.doc"); msg.Attachments.Add(at);

  16. Leverage Outlook Mobile “cards” Appointment appt = new Appointment(); appt.Subject = "Launch Windows Mobile 5.0!"; appt.AllDayEvent = true; appt.Start = new DateTime(2005, 5, 10); outlook.Appointments.Items.Add(appt); appt.ShowDialog();

  17. ChooseContact Dialog • ChooseContactDialog cChooser = new • ChooseContactDialog(); • If (cChooser.ShowDialog() == DialogResult.OK) • { • // Specify what happens on a • // successful return here • }

  18. SelectPicture Dialog • SelectPictureDialog pChooser = new • SelectPictureDialog(); • If (pChooser.ShowDialog() == DialogResult.OK) • { • // Specify what happens on a • // successful return here • }

  19. CameraCapture Dialog • CameraCaptureDialog cam = new CameraCaptureDialog(); • If (cam.ShowDialog() == DialogResult.OK) • { • // Specify what happens on a • // successful return here • }

  20. Managed Configuration Manager Accepts any standard DMProcessConfig XML for any CSP XmlDocument configDoc = new XmlDocument(); configDoc.LoadXml( "<wap-provisioningdoc>"+ "<characteristic type=\"BrowserFavorite\">"+ "<characteristic type=\"Microsoft\">"+ "<parm name=\"URL\" value=\"http://www.microsoft.com\"/>"+ "</characteristic>"+ "</characteristic>"+ "</wap-provisioningdoc>" ); ConfigurationManager.ProcessConfiguration(configDoc, false);

  21. Control the Messaging Application • Initiate synchronization • Display the inbox • Display the compose form public static void DisplayComposeForm( string accountName, string toAddresses, string ccAddresses, string bccAddresses, string subject, string body, string[] attachments );

  22. Intercept SMS Messages in Native Code //====================================================================== // MonitorThread - Monitors event for timer notification // DWORD WINAPI MonitorThread (PVOID pArg) { TEXT_PROVIDER_SPECIFIC_DATA tpsd; SMS_HANDLE smshHandle = (SMS_HANDLE)pArg; PMYMSG_STRUCT pNextMsg; BYTE bBuffer[MAXMESSAGELEN]; PBYTE pIn; SYSTEMTIME st; HANDLE hWait[2]; HRESULT hr; int rc; DWORD dwInSize, dwSize, dwRead = 0; hWait[0] = g_hReadEvent; // Need two events since it isn't hWait[1] = g_hQuitEvent; // allowed for us to signal SMS event. while (g_fContinue) { rc = WaitForMultipleObjects (2, hWait, FALSE, INFINITE); if (!g_fContinue || (rc != WAIT_OBJECT_0)) break; // Point to the next free entry in the array pNextMsg = &g_pMsgDB->pMsgs[g_pMsgDB->nMsgCnt]; // Get the message size hr = SmsGetMessageSize (smshHandle, &dwSize); if (hr != ERROR_SUCCESS) continue; // Check for message larger than std buffer if (dwSize > sizeof (pNextMsg->wcMessage)) { if (dwSize > MAXMESSAGELEN) continue; pIn = bBuffer; dwInSize = MAXMESSAGELEN; } else { pIn = (PBYTE)pNextMsg->wcMessage; dwInSize = sizeof (pNextMsg->wcMessage); } // Set up provider specific data tpsd.dwMessageOptions = PS_MESSAGE_OPTION_NONE; tpsd.psMessageClass = PS_MESSAGE_CLASS0; tpsd.psReplaceOption = PSRO_NONE; tpsd.dwHeaderDataSize = 0; // Read the message hr = SmsReadMessage (smshHandle, NULL, &pNextMsg->smsAddr, &st, (PBYTE)pIn, dwInSize, (PBYTE)&tpsd, sizeof(TEXT_PROVIDER_SPECIFIC_DATA), &dwRead); if (hr == ERROR_SUCCESS) { // Convert GMT message time to local time FILETIME ft, ftLocal; SystemTimeToFileTime (&st, &ft); FileTimeToLocalFileTime (&ft, &ftLocal); FileTimeToSystemTime (&ftLocal, &pNextMsg->stMsg); // If using alt buffer, copy to std buff if ((DWORD)pIn == (DWORD)pNextMsg->wcMessage) { pNextMsg->nSize = (int) dwRead; } else { memset (pNextMsg->wcMessage, 0, sizeof(pNextMsg->wcMessage)); memcpy (pNextMsg->wcMessage, pIn, sizeof(pNextMsg->wcMessage)-2); pNextMsg->nSize = sizeof(pNextMsg->wcMessage); } // Increment message count if (g_pMsgDB->nMsgCnt < MAX_MSGS-1) { if (g_hMain) PostMessage (g_hMain, MYMSG_TELLNOTIFY, 1, g_pMsgDB->nMsgCnt); g_pMsgDB->nMsgCnt++; } } else { ErrorBox (g_hMain, TEXT("Error %x (%d) reading msg"), hr, GetLastError()); break; } } SmsClose (smshHandle); return 0; }

  23. Intercept SMS Messages in Managed Code MessageInterceptor sms; void Form_Load( ... ) { sms = new MessageInterceptor(); //... Optional: set interception condition here sms.MessageReceived += new EventHandler(sms_MessageReceived); } void sms_MessageReceived(...) { //... Handle incoming message }

  24. Create Smart Mobile Apps with the State & Notification Broker

  25. Gathering state information previously was difficult • Problems: • Different APIs for querying different properties • Different change notification mechanisms for different properties • Many properties not exposed (especially in .NET CF) • No standard way for OEMs and developers to expose their own properties

  26. State & Notification Broker Strategy • Placement of useful information in documented locations • Native APIs to get notified of changes to any registry value • Managed wrapper around native APIs

  27. State & Notification Broker Architecture Microsoft.WindowsMobile.Status RegExt.h SNAPI.h Interesting Values Registry

  28. There Are Over 100 System Properties • Power & Battery • Appointments • Media Player • Connectivity • ActiveSync • Messaging • Telephony • Hardware • Tasks • Shell

  29. Two Ways to Query for Current Values • Dynamic • Static SystemState callerId = new SystemState( SystemProperty.PhoneIncomingCallerContact); Contact c = (Contact)callerId.CurrentValue; Contact c = SystemState.PhoneIncomingCallerContact;

  30. Get Change Notifications • Create a SystemState object • Attach an event handler SystemState callerId = new SystemState( SystemProperty.PhoneIncomingCallerContact); callerId.Changed += new ChangeEventHandler(callerId_Changed); void callerId_Changed(object sender, ChangeEventArgs args) { // ... }

  31. NEW: Volatile Registry Keys • Problem: • IM client publishes a “number of online contacts” value in the registry. User logs in and this gets set to 15. Device is reset so user is no longer logged in. Value in the registry (15) is no longer accurate. • Solution: Volatile registry keys • Just like regular registry keys except they die when the device turns off • Better performance • Always in RAM • Never flushed to persistent storage

  32. Extensibility! • Publish your own state • Get notified of changes to any registry value public class MyClass { RegistryState state; // defined globally to class private void Form1_Load(object sender, EventArgs e) { // RegistryState state; // This instance will go out of scope if defined here! RegistryState state = new RegistryState("HKEY_LOCAL_MACHINE\\MyKey", "MyValue"); state.Changed += new ChangeEventHandler(state_Changed); } }

  33. Get Notified While Your Application Is Not Running • Can be used for • SMS interception • State & notification broker • When a change occurs • Windows Mobile launches the application • Application hooks up an event hander • Event is fired

  34. AnotherApp.LowBattery … MyApp.LostPhoneSMS AnotherApp.IncommingCall Get Notified While Your Application Is Not Running (cont’d) SystemState missedCall; void Form_Load( … ) { if(!SystemState.IsApplicationLauncherEnabled(“MyApp.MissedCall”)) { // ... Initialize missedCall missedCall.EnableApplicationLauncher( “MyApp.MissedCall” ); } else { SystemState missedCall = new SystemState(“MyApp.MissedCall”); } missedCall.Changed += new EventHandler( missedCall_Changed ); } SystemState missedCall; void Form_Load( … ) { // TODO: Initialize missedCall missedCall.Changed += new EventHandler( missedCall_Changed ); } SystemState missedCall; void Form_Load( … ) { if(!SystemState.IsApplicationLauncherEnabled(“MyApp.MissedCall”)) { } else { } missedCall.Changed += new EventHandler( missedCall_Changed ); } SystemState missedCall; void Form_Load( … ) { if(!SystemState.IsApplicationLauncherEnabled(“MyApp.MissedCall”)) { // ... Initialize missedCall missedCall.EnableApplicationLauncher( “MyApp.MissedCall” ); } else { } missedCall.Changed += new EventHandler( missedCall_Changed ); } Persisted Notifications MyApp.MissedCall

  35. Conditions Prevent Unnecessary Notifications SystemState missedCall; void Form_Load( … ) { if(!SystemState.IsApplicationLauncherEnabled(“MyApp.MissedCall”)) { // ... Initialize missedCall missedCall.EnableApplicationLauncher( “MyApp.MissedCall” ); } else { SystemState missedCall = new SystemState(“MyApp.MissedCall”); missedCall.ComparisonType = StatusComparisonType.Equal; missedCall.ComparisonValue = true; } missedCall.Changed += new EventHandler( missedCall_Changed ); }

  36. New Tool Chain • Integrated, uniform toolset for native & managed development • Improved user interface designers • Improved data design tools • Multiplatform development • Improved debugger • New ARM device emulator engine • New device CAB project type

  37. Call to Action • Install Visual Studio 2005 • Install Windows Mobile 5.0 SDKs • Start developing for mobile devices today!

  38. © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

More Related