Using ConnMgr wrapper

T

Tim Johnson

I see OpenNetCF has a Connection Manager wrapper around the ConnMgr stuff.
Before I launch off and use it I thought I'd ask a question first.

We're using a GPRS-based PDA and frequently I'll have 4-bars for voice
coverage but not have data coverage (the vendors tell me they don't use the
same infrastructure in the various vendor cell networks). So my invocations
of webservices fail with the ever-informative "Web Exception". When this
happens it's preceded by the little bubble notifications as the phone tries
to dial out, and it variously shows a "Cannot connect" or "No modem
available". What it really means is it can't make the data connection to
the server.

My question is, can I use the ConnMgr facility to determine ahead of time
whether a data call is possible, instead of forcing the user to watch the
bubbles, wait 10-40 seconds only to get a variety of error messages? I was
thinking of testing signal strength (if there's one for data vs. voice), or
checking if I have an IP address (the idea being if I'm not connected I
won't, if I am I will). Or maybe I can make the data connection with code
first, test if it worked, and THEN call my webservice only when I know I
have a good connection?

I'm not sure if anyone has experience with this specific problem and knows a
good way to test your connection, either ahead of time before making the
webservice call, or afterwards to enhance the error message you can report.

--

Tim Johnson
High Point Software, Inc.
www.high-point.com
(503) 312-8625
 
P

Peter Foot [MVP]

When you call a webservice on a Windows Mobile device the framework is
calling down to the connection manager APIs under the hood to try to
establish a connection. You can pre-empt this by creating the connection
first using these APIs - through a wrapper. Then you'll be able to check
whether the connection was successful and avoid calling the service if you
can't connect.
A side issue which you have run into is the error messages - "Cannot
connect" this is a bug (or is it a feature) in Pocket PC 2003 which is
apparently fixed in Second Edition whereby even if you establish a
background connection using connection manager it will stil pop up this
error bubble. There is no workaround other than killing the dialog -
findwindow and send a wm_close message is the only option. This bugs us in
our application because our devices are mounted in vehicles and although the
UI is designed for night usage, we get a bright white flash on the screen
when this bubble appears (and there is no way to change the system colours
for notification bubbles).
One of the good things about connection manager is you can use it
asynchronously so you can leave it to try to establish a connection and then
decide on whether to make the webservice call if it succeeds.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top