Download presentation
Presentation is loading. Please wait.
Published byMeagan Parsons Modified over 9 years ago
2
Developing Mobile Applications Tim Heuer Immedienttim.heuer@immedient.com Bert Solano Immedientbert.solano@immedient.com
3
Agenda Mobile Overview Mobile Overview VS.NET Features VS.NET Features Data Storage Options Data Storage Options Tips and Tricks Tips and Tricks
4
CE Devices are available
5
Mobile vs. Wireless Mobile Architectures Mobile Architectures Application can function in a vacuum “Synchronize When You Can” Wireless Wireless Tethered to the data source, just like wired, only we use wireless WiFi, CDPD, GPRS, Prone to problems Mobile Apps leverage Wireless Mobile Apps leverage Wireless Wireless is NOT Mobile Wireless is NOT Mobile
6
Goal for a Mobile App Can your user function from the bottom of the ocean? (… with a waterproof device) Can your user function from the bottom of the ocean? (… with a waterproof device) Is your application as reliable as their paper notebook? Is your application as reliable as their paper notebook? Take advantage of the internet, don’t depend on it. Take advantage of the internet, don’t depend on it.
7
Compatibility Challenges Many different device types Many different device types Different form-factors Human interface choices Connectivity choices WiFiNetwork CradleCompact Flash WWanDesktop CradleInfra Red On-device resources vary widely On-device resources vary widely ROM/RAM capacity File system Battery life
8
Mobile Development Environment Single set of familiar productive tools for all development Server components Rich client applications Mobile Web development Building Web services Consuming Web services Easily take advantage of all Microsoft mobile platform assets
9
Mobile Development Approaches Application on device Application on device Device specific Device specific Fewer devices Fewer devices Application on server Application on server Runs in browser Runs in browser Many devices Many devices Offline options Offline options Richest UI Richest UI Online only Online only Less UI choice Less UI choice Easy to deploy Easy to deploy Client Application Web Application
10
Mobile Development Tools Client Application Web Application Embedded Visual Tools eVB and eVC++ Device-specific Active Server Pages Visual Studio &.NET Compact Framework Visual Studio & Mobile Internet Toolkit Today
11
Mobile Internet Toolkit Components Components Mobile controls Mobile designer Rich device identification Rapidly develop Mobile Web Applications Rapidly develop Mobile Web Applications Powerful and flexible Powerful and flexible Easy to customize and extend Easy to customize and extend For future devices
12
Mobile Controls Render based on device capabilities Render based on device capabilities Automatically output multiple markup languages Automatically output multiple markup languages Built upon ASP.NET control base classes Built upon ASP.NET control base classes Common controls: Common controls: Label TextView Link Calendar
13
.NET Compact Framework Smart Device Extensions Smart Device Extensions A subset of the.NET Framework A subset of the.NET Framework Same programming model Same security as desktop programming model Lightweight and Resource Efficient Lightweight and Resource Efficient RAM Battery and CPU usage Flash and ROM Rich PocketPC Functionality Rich PocketPC Functionality Windows Forms (WinForms) ADO.NET Data Access XML Web Services Client
14
With Windows CE Windows UI Standard Windows look and feel Standard Windows look and feel Forms-based UI Forms-based UI All the standard controls All the standard controls Significant subset for small size Significant subset for small size XML Web Services Windows NT ® network integration Windows NT ® network integration Data Access Local data (offline) Local data (offline) Remote data (online) Remote data (online) Simple structured files (text) Simple structured files (text) Take advantage of Windows richness Windows CE Device Base Class Library Data and XML XML Web Services Windows Forms Common Language Runtime
15
Device Compatibility.Net Compact Framework.Net Compact Framework Faithful implementation of Standard CLI Core types and methods + device extensions Subset of.Net framework appropriate to smart device development ISO/IEC 23271:2002 / ECMA 335 Common Language Infrastructure Microsoft.NET Compact Framework Pocket PC (CE) Microsoft Windows CE Extensions IRDA, Barcode Scanner, etc Microsoft.NET Compact Framework Smart Phone Microsoft Full.NET Framework Desktop
16
It’s All About Balance (Developer Perspective) Features Features Amount of Data Amount of Data Garbage Collection Garbage Collection Data Entry/Selection Data Entry/Selection Performance Performance Memory Usage Memory Usage Data, Objects Connectivity Connectivity This is NOT the desktop, think 100mhz
17
Device Databases
18
Microsoft Strategy Scalable Solutions Scalable Solutions Scalable Solutions MSDE SQL Server CE SQL Server } Server, Desktop, Tablet PC CE Platform
19
SQL Server CE (SQL CE) Database for the CE / Pocket PC Platform Database for the CE / Pocket PC Platform Similar programming style to SQL Server Similar programming style to SQL Server Limitations are more device then SQL/CE Limitations are more device then SQL/CE 1 Connection/ Database, (usually not a problem) 1 Connection/ Database, (usually not a problem) Multiple Databases per device Multiple Databases per device No Stored procs No Stored procs Use cached DataCommands Referential Integrity with cascading updates/Deletes Referential Integrity with cascading updates/Deletes Stand alone, or replicate/sync with SQL Server Stand alone, or replicate/sync with SQL Server SQL Server not required, but best match SQL Server CE 2.0 designed for.NET Compact Framework (System.Data.SqlServerCe) SQL Server CE 2.0 designed for.NET Compact Framework (System.Data.SqlServerCe) Replacement of Pocket Access, just like DBF/Access Replacement of Pocket Access, just like DBF/Access
20
CE Data Access Storage Architecture OLEDB CE CLR /.NET CF QP/Cursor Engine/ES Client Agent: Replication andRDA ADO CE v3.1 OLEDB / Replication API IIS CLIENT SERVER Storage Engine / Repl Tracking SQL CE Edition v2.0 eVB 3.0 eVC 3.0 OLEDB OLEDB Server Agent: Replication and Remote Data Access HTTP 802.11b, CDPD, GSM, CDMA, TDMA, etc. SQL Server CE Data Provider Native/Unmanaged Stack Data Provider SQL Server Client Data Provider ADO.NET VS.NET (VB.NET, C#).NET CF / Managed Stack TDS Ethernet Well Connected Occasionally Connected
21
Setting up SQL CE Replication Basic Replication setup + Basic Replication setup + Install SQL CE Replication Tools Install SQL CE Replication Tools http://www.microsoft.com/sql/downloads/ce/sp3.asp http://www.microsoft.com/sql/downloads/ce/sp3.asp Test connectivity from device Test connectivity from device Localhost won’t work NETBIOS name may not work (WINS Resolution) Test with IP or Fully Qualified Domain Name If you don’t get this response from the DLL, don’t go any further http://192.168.1.100/Repll/sscesa20.dll
22
SQL / CE – Data Transfer Multiple Techniques RDA system.Data.SqlServerCe.SqlCeRemoteDataAccess RDA system.Data.SqlServerCe.SqlCeRemoteDataAccess Great for semi-connected environments, large data transfers Merge Replication Over IIS Merge Replication Over IIS System.Data.SqlServerCe.SqlCeReplication System.Data.SqlServerCe.SqlCeReplication Great for managing concurrency ADO.net System.Data.SqlClient.SqlCommand ADO.net System.Data.SqlClient.SqlCommand Can call SQL Server directly, but not a great idea…* (*Not a Mobile Architecture) Web Services Web Services Great when concurrency isn’t an issue, or server isn’t SQL
23
Supported ADO.NET And XML Classes On.NET CF XmlWriter DataSet XmlDocument.NET Data Provider for SQL Server XML File SqlConnection SqlDataAdapter SqlCommand XmlReader.NET Data Provider for SQL CE SqlCeConnection SqlCeDataAdapter SqlCeCommand DataView SqlDataReaderSqlCeDataReader
24
Parsing Exceptions public static void ShowErrors(SqlCeException se) { SqlCeErrorCollection errorCollection = se.Errors; StringBuilder exInfo= new StringBuilder(); Exception inner = se.InnerException; foreach (SqlCeError err in errorCollection) { exceptionDetailStringBuilder.Append("\n Error Code: " + err.HResult.ToString("X")); exceptionDetailStringBuilder.Append("\n Message : " + err.Message); exceptionDetailStringBuilder.Append("\n Minor Err.: " + err.NativeError); exceptionDetailStringBuilder.Append("\n Source : " + err.Source); foreach (int numPar in err.NumericErrorParameters) { if (0 != numPar) exceptionDetailStringBuilder.Append("\n Num. Par. : " + numPar); } foreach (string errPar in err.ErrorParameters) { if (String.Empty != errPar) exceptionDetailStringBuilder.Append("\n Err. Par. : " + errPar); } MessageBox.Show(exceptionDetailStringBuilder.ToString()); exceptionDetailStringBuilder.Remove(0, exceptionDetailStringBuilder.Length); }
25
Mobile Application
26
Tips and Tricks Always think Performance, …always Always think Performance, …always Test performance on everything Get the actual device Get the actual device Design and Proof of Concept EVERYTHING Design and Proof of Concept EVERYTHING Get a wireless Lan for debugging Get a wireless Lan for debugging Reuse everything you can Reuse everything you can Database optimization is KEY Database optimization is KEY Don’t assume flat is good. Balance of normalization is good Don’t assume your.sdf needs to have the same structure as the server
27
Tips and Tricks This is NOT a 1.8GHZ Processor This is NOT a 1.8GHZ Processor Think 100MHZ Be kind to your environment Be kind to your environment Reuse Everything Pre-Load Data Pre-Load Data Use DataSets to cache data …more to come… Save Forms that will be used again Save Forms that will be used again Use a forms collection that caches forms Toss objects that you don’t use often Toss objects that you don’t use often Don’t try to load 9 MB of data onto a device with 8 MB of RAM Don’t try to load 9 MB of data onto a device with 8 MB of RAM protected override void OnClosing(CancelEventArgs e) { this.Save(); e.Cancel = true; this.Hide(); base.OnClosing (e); }
28
Resources Newsgroups: Newsgroups: microsoft.public.dotnet.framework.compactframework http://www.gotdotnet.com/team/netcf http://www.gotdotnet.com/team/netcf SQL CE SQL CE http://www.microsoft.com/sql/ce/ http://www.microsoft.com/sql/ce/techinfo/defa ult.asp Article on Setting up a sample Replication and RDA http://msdn.microsoft.com/library/default.asp? url=/library/en-us/dnsqlce/html/sqlwince.asp
29
Q & A
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.