connectivity in a mobile world dave glover developer evangelist microsoft australia ltd pty blog: ...

33

Post on 19-Dec-2015

215 views

Category:

Documents


2 download

TRANSCRIPT

Connectivity in a Mobile WorldConnectivity in a Mobile World

Dave GloverDeveloper Evangelist Microsoft Australia Ltd PtyBlog: http://blogs.msdn.com/dglover (inc Mobile Dev Channel)

Nick RandolphSoftTeq Blog: http://community.softteq.com/blogs/nick

Dave GloverDeveloper Evangelist Microsoft Australia Ltd PtyBlog: http://blogs.msdn.com/dglover (inc Mobile Dev Channel)

Nick RandolphSoftTeq Blog: http://community.softteq.com/blogs/nick

patterns and practices for Mobilepatterns and practices for Mobile

Connectivity

User Experience

Business Logic

Data and Web Svc

Managing Connection

Physical Addresses

Occasionally Connected Web Services

Data Synchronization

Managing Subscriptions

Security

Web Service Credentials

Authorization

Business Logic

Queues

Management

Deployment

Logging

User Experience

WinForms CAB Extensions for Mobile

Views

Presenters

Business Entities

Business Logic Controllers

Business Workflows

CAB

Configuration

ReplicationReplication Web Services CallsWeb Services Calls

Mobile Device

Gateway

Staging DBStaging DBBusiness DataConfiguration DataDeployment DataWeb Web

ServicesServicesBusiness TransactionsLogging

Admin ConsoleAdmin Console

VS.NET

Mobile Designer Form FactorDot Density (DPI)Orientation

What’s new for connectivity in Windows Mobile 5…

What’s new for connectivity in Windows Mobile 5…

What’s New in Web ServicesWhat’s New in Web Services

.NET CF 2.0 Web Service ChangesProgramming model unchanged

Support for Soap 1.2 added

Utilizes new XmlSerializerReplaces custom serialization in .NET CF 1.0

Substantially faster

.NET CF 2.0 Web Service ChangesProgramming model unchanged

Support for Soap 1.2 added

Utilizes new XmlSerializerReplaces custom serialization in .NET CF 1.0

Substantially faster

Windows Mobile 5.0State and Notification BrokerWindows Mobile 5.0State and Notification Broker

Common state storage and event notification

Applications need to know device capabilitiesPhone available, power remaining, camera available, etc.

Applications need to know system changesNetwork connectivity, plugged in, phone call arriving

State and Notification Broker provides over 100 values

Type of connectivity availableGPRS, Modem, ActiveSync, WiFi

The device's ActiveSync status

Number of unread SMS/e-mail messages

Common state storage and event notification

Applications need to know device capabilitiesPhone available, power remaining, camera available, etc.

Applications need to know system changesNetwork connectivity, plugged in, phone call arriving

State and Notification Broker provides over 100 values

Type of connectivity availableGPRS, Modem, ActiveSync, WiFi

The device's ActiveSync status

Number of unread SMS/e-mail messages

ConnectivityState and Notification Broker APIConnectivityState and Notification Broker API

State and Notification Broker API (SNAPI)Provides access to system state values

Includes connectivity state information

Available to all environments running on WM 5.0Native C/C++

Managed .NET CF 1.0 & 2.0

Applications can register for events

Can automatically start application if not already running

State and Notification Broker API (SNAPI)Provides access to system state values

Includes connectivity state information

Available to all environments running on WM 5.0Native C/C++

Managed .NET CF 1.0 & 2.0

Applications can register for events

Can automatically start application if not already running

ConnectivitySNAPI GPRS notification in C#ConnectivitySNAPI GPRS notification in C#

SystemState gprsState;;

public Form1()public Form1(){{ InitializeComponent();InitializeComponent();

gprsState = gprsState = new new SystemState(SystemProperty.PhoneGprsCoverage));; gprsState.gprsState.Changed += += new new ChangeEventHandler(gprsState_Changed);;}}

void gprsState_Changed(object sender, void gprsState_Changed(object sender, ChangeEventArgs args)){{ bool gprsCoverage = (bool)bool gprsCoverage = (bool)args.NewValue;; if (gprsCoverage)if (gprsCoverage) StartDataTransfer();StartDataTransfer(); elseelse StopDataTransfer();StopDataTransfer();}}

Partially Connected ClientsPartially Connected Clients

Patterns and PracticesPatterns and Practices

Partially Connected ClientsPartially Connected Clients

Existing SystemsWeb ServicesDatabasesLegacy?

Mobile GatewayAddressableWeb servicesStaging of dataManagement Policy

Mobile ClientUI & Business LogicOffline cache & queuesSecurity & managementComposable shell

GPRS

EDGE

802.11

Cradle

Web Services

BizTalk

HIS

ETL

Connectiv

ity

Secu

rity

Web Services

SQL Replicatio

n

Policy Admin Console

Web Services & Data

Managem

ent

User ExperienceUser Experience

Business LogicBusiness Logic

Data & Web SvcData & Web Svc

Windows Mobile 5.0Compact Framework 2.0

Connection Types Pros and ConsConnection Types Pros and Cons

How Pros Cons

Cell Generally available Expensive, Slow, Unreliable

Nic & WiFi Fast

Cheap(er)

Not as available

Heavy of battery life

Bluetooth Fast enough

Cheap

Low power

Difficult to set up!!

Compatibility

Limited Distance

RAPI/ActiveSync

Widely supported Cheap Complex to program

Some Carriers my block

MSMQ Partially Connected Complex to deploy

Web Services Ubiquitous Requires a connection

SQL Data Replication

Rides on HTTP

Check Pointing, Compression, Encrypted

Requires a SQL CAL

IIS ISAPI Ext

Choosing Sync ArchitectureChoosing Sync Architecture

CRITERIA BEST CHOICE VIABLE CHALLENGING

Connectivity - Firewall Friendly WS RDA/Merge

Connectivity - WWAN/Dialup RDA WS Merge

Connectivity - WLAN RDA WS/Merge

Conflict Resolution Merge WS RDA

Code to Implement RDA Merge WS

Setup/Deployment Effort RDA WS Merge

On-Going Administration RDA WS Merge

Enterprise Management Merge WS RDA

Large Data Volumes Merge/RDA WS

Server DBMS Independence WS

Auto SQL CE DBMS Creation Merge

Ability to Secure Data Sync Merge RDA/WS

Overall Complexity RDA WS Merge

Common ScenarioCommon Scenario

Merge/Merge/Replication or Replication or

SMSSMSDownload Download

reference, read-reference, read-only dataonly data

11

22

Disconnected Service Disconnected Service AgentAgent

Submit new and changed Submit new and changed data to server via web data to server via web

service callservice call

33Mobile Data Update Mobile Data Update

(ETL)(ETL)Tables on Mobile SQL Tables on Mobile SQL

Server database Server database updatedupdated

11

Web ServiceWeb Service

Mobile Data GatewayMobile Data Gateway

44ReconciliationReconciliation

Connection Monitor Application BlockConnection Monitor Application Block

Connection MonitorConnection MonitorQuery active network (Work, Internet, Home) & connection (DTPT, WiFi, GPRS…)

Events for changes to active network and connection

Dispatcher sends requests based on price/cost of active connection

Query active network (Work, Internet, Home) & connection (DTPT, WiFi, GPRS…)

Events for changes to active network and connection

Dispatcher sends requests based on price/cost of active connection

Connection MonitorConnection Monitor

DaveDave

Disconnected Web ServicesApplication Block

Disconnected Web ServicesApplication Block

Request Queue

Disconnected Service AgentCurrent StatusDisconnected Service AgentCurrent Status

Callbacks for ReturnsCallbacks for Returns

MyService.asmxMyService.asmxMyServiceProxyMyServiceProxy

“Offline” flavor interface

One-way methods

Overloads with “Behavior”

Callbacks for results

IMyServiceOffline

RequestRequest

BehaviorCallbacks“Stamps”Exceptionetc

BehaviorCallbacks“Stamps”Exceptionetc

ArgumentsValues for web service call

ArgumentsValues for web service call

Generated CodeGenerated Code

Web ServiceWeb Service

App Block Code

Optional SOAP Header for server idempotency

Server

DispatcherSynch Manager

Background, Events, API

Offline Service AgentOffline Service Agent

Physical Addresses

AuthN credentials

Request ID

Disconnected Web ServiceExampleDisconnected Web ServiceExample

OfflineSubmitOrderOfflineSubmitOrder

void SubmitOrder(“T-Shirt”);void SubmitOrder(“T-Shirt”);11

Service.SubmitOrderService.SubmitOrder

bool SubmitOrder(string, out DateTime);bool SubmitOrder(string, out DateTime);22

SubmitOrderCallbackSubmitOrderCallback

Succeeded(bool, string, out DateTime);Succeeded(bool, string, out DateTime);33

SubmitOrderCallbackSubmitOrderCallback

SubmitOrder(bool, string, DateTime);SubmitOrder(bool, string, DateTime);44

Wizard CreatedWizard Created

Visual StudioVisual Studio

Your CodeYour Code

Physical AddressesResolving based on connectionPhysical AddressesResolving based on connection

Address based onNetwork

Address based onNetwork

MyServiceProxyMyServiceProxy

Dispatcher

Physical Addresses

Auth credentials

Request.ID

<EndPoints><EndPoints> <EndPoint Name=<EndPoint Name=""SubmitOrderSubmitOrder"">> <Network<Network Name="My Name="My ISPISP"" Address="Address="www.contoso.com/submit.asmxwww.contoso.com/submit.asmx""/>/> <Network Name=<Network Name="My Work Network""My Work Network" Address=Address=""//orders/submit.asmx//orders/submit.asmx""/>/> <EndPoint><EndPoint></EndPoints></EndPoints>

IdempotencyIdempotency

ID value added to SOAP header if present

ID value added to SOAP header if present

MyServiceProxyMyServiceProxy

Dispatcher

Physical Addresses

Auth credentials

Request.ID

Disconnected Web ServiceDisconnected Web Service

NickNick

Web Services and CompressionWeb Services and Compression

Is Compression Worth It? Yes it is!Is Compression Worth It? Yes it is!Can expect up to

20% of original payload size

Reduces the volume of data to transfer

Improved effective performance

Reduced network latency

Minimal impact on device (RAM & CPU)

On Public Wireless Networks reduces $/Kb

Reduces Total Cost of Ownership (TCO)

Can expect up to 20% of original payload size

Reduces the volume of data to transfer

Improved effective performance

Reduced network latency

Minimal impact on device (RAM & CPU)

On Public Wireless Networks reduces $/Kb

Reduces Total Cost of Ownership (TCO)

http://www.businessanyplace.net/?p=wscompress

Sm

all P

aylo

ad

Sm

all P

aylo

ad

Larg

e P

aylo

ad

Larg

e P

aylo

ad

Web Service CompressionWeb Service Compression

XML Web Services & CompressionXML Web Services & Compression

Addition information on HTTP compression:

http://www.flowgroup.fr/en/kb/technical/compressionhttp.aspx

http://bistrica.usask.ca/madmuc/Grads/Adnan/cmpt898/Project.pdf

http://blog.opennetcf.org/ayakhnin/CommentView.aspx?guid=7ce7be20-ff09-4d38-b53f-018654c287d0

http://www.businessanyplace.net/?p=wscompress2

Addition information on HTTP compression:

http://www.flowgroup.fr/en/kb/technical/compressionhttp.aspx

http://bistrica.usask.ca/madmuc/Grads/Adnan/cmpt898/Project.pdf

http://blog.opennetcf.org/ayakhnin/CommentView.aspx?guid=7ce7be20-ff09-4d38-b53f-018654c287d0

http://www.businessanyplace.net/?p=wscompress2

SMS Interception SMS Interception

Application NotificationApplication Notification

SMS InterceptionPocketOutlook.MessageInterceptionSMS InterceptionPocketOutlook.MessageInterception

Receive notification when an SMS arrivesTransient notifications

Persistent notifications

Optionally delete the SMS

Can filter SMS notifications using conditions

SMS Fields: Body or Sender

Operators: Equal, Not Equal, Contains, StartsWith, EndsWith

Receive notification when an SMS arrivesTransient notifications

Persistent notifications

Optionally delete the SMS

Can filter SMS notifications using conditions

SMS Fields: Body or Sender

Operators: Equal, Not Equal, Contains, StartsWith, EndsWith

MessageInterceptor MessageInterceptor mi = newmi = new M MessageInterceptor();essageInterceptor();mi.InterceptionAction = InterceptionAction.NotifyAndDelete;mi.InterceptionAction = InterceptionAction.NotifyAndDelete;

MessageCondition mc = new MessageCondition();MessageCondition mc = new MessageCondition();mcmc.CaseSensitive = .CaseSensitive = truetrue;;mmcc.ComparisonType = MessagePropertyComparisonType.ComparisonType = MessagePropertyComparisonType.StartsWith.StartsWith;;mc.mc.ComparisonValue = “ComparisonValue = “%^&MEDC%^&MEDC";";mi.MessageCondition = mi.MessageCondition = mc;mc;

mi.MessageReceived += mi.MessageReceived += new MessageInterceptorEventHandler(mi_MessageReceived);new MessageInterceptorEventHandler(mi_MessageReceived);

void mivoid mi__MessageReceived(object sender, MessageReceived(object sender, MessageInterceptorEventArgs e)MessageInterceptorEventArgs e){{ if (e.Message is SmsMessage)if (e.Message is SmsMessage) {{ SmsMessage sms = (SmsMessage)e.Message;SmsMessage sms = (SmsMessage)e.Message; }}}}

Using the MessageInterceptorUsing the MessageInterceptor

SMS Interception ScenariosSMS Interception Scenarios

Auto Load an ApplicationAuto Load an Application

SMS as a transportSMS as a transportStart an auto-updateStart an auto-update

Remote queriesRemote queries

Remote control/administrationRemote control/administration

Auto Load an ApplicationAuto Load an Application

SMS as a transportSMS as a transportStart an auto-updateStart an auto-update

Remote queriesRemote queries

Remote control/administrationRemote control/administration

SMS NotificationsExampleSMS NotificationsExample

Trigger UpdateTrigger Update

SMS InterceptorSMS Interceptor

11

Data SyncData Sync

33

SMS NetworkSMS Network

44

LOB App submits SMSLOB App submits SMS

22

patterns & practices Availabilitypatterns & practices AvailabilityBooks and DVDs available:http://www.amazon.com/practices

Available online:http://www.microsoft.com/practices

Mobile Community:Mobile Community:http://practices.gotdotnet.com/projects/mobile

Community:Community:http://www.gotdotnet.com

© 2006 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it

should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.