0

I have an application that uses cellphone data connection to communicate with a remote server over web services. However, due to the unreliability of the cell phone network the application doesn't work for as long as the cell network is down. So what I want to do is change the application to process orders directly on the device and upload the orders in the background (like a windows service) when internet is available.

Here's what I'm thinking:

2 Applications

App #1: Change the order taking application to connect to internet at application load to get all settings and save to a sdf DB. Once settings are saved locally the user can process orders and save to database.

App #2: Runs in the background constantly checking db (say every 3-5 mins) for orders and upload to remote server via WCF web service. Additionally after upload is completed updated settings are downloaded back to the device.

App #2 is what I need guidance on. On a desktop I could run a windows service however compact framework of windows mobiles doesn't appear to have a windows service type support.

Any advice?

CoderK
  • 53
  • 7

1 Answers1

2

Why run it as a separate app? In that case you'll have to do cross-process synchronization of data access to make sure that simultaneous access from both processes doesn't cause a problem. Why not create a background "service" thread inside the app itself to do data forwarding to the enterprise?

ctacke
  • 66,480
  • 18
  • 94
  • 155
  • Hello @ctacke, is there some resource you can point me to with regards to creating a background thread that operates in the way that you speak? Thanks in advance – CoderK Mar 26 '13 at 17:04
  • Nothing specific, no. Basically just spawn a thread early on and have that thread live for the life of the app, uploading data. Typically I'd have a class that encapsulates it and the data to be sent. Push data to a queue in the class and have the thread continually try to empty the queue. – ctacke Mar 26 '13 at 17:21