0

Good day! i have a problem need to be solve. I have a application in windows mobile 6.0 6.5 that save data to xml file this app run as what i want but i need to push the xml file file to the server. I already have my web service but my problem is i don't know how to run a background process app when my device connect to the internet. Hope someone can help me.

Thanks in advance

Angelo
  • 335
  • 4
  • 10
  • If you don't give us information about the service how can we tell you how to call it? This is impossible to answer without more information. – Ron Beyer May 28 '15 at 02:19
  • @RonBeyer I think its not clear i edited my question. what i mean is i want to run/start the application when the device connected to the internet. i know how to call the webservice what i don't know is how to run the app everytime the device connected to the internet. Thanks buddy for your comment and sorry for my english – Angelo May 28 '15 at 02:28
  • 1
    Bear in mind that just because the device is connected to the internet, that does not automatically mean that you'll be able to successfully transfer the file to the server. Remember to write the code that deals with failures (server not present, loss of connection part way through transfer, etc) and makes appropriate retry attempts. Once you've written that code, you'll realise you may as well let it run immediately and cope with an initial failure as easily as any later one. – Damien_The_Unbeliever May 28 '15 at 06:38
  • @Damien_The_Unbeliever Yes buddy, when application starts it checks first if the connection is available or not. – Angelo May 28 '15 at 06:39
  • 1
    My point is, checking first gives you no guarantee that the rest of the program can do its job. In fact, checking for an internet connection is almost always pointless because, by the time your code has obtained an answer, the actual reality may have changed. – Damien_The_Unbeliever May 28 '15 at 07:40
  • Got it thanks for the tips will keep on digging and test for all possible failures. – Angelo May 28 '15 at 07:43

1 Answers1

2

Although there are events that can launch an application for Docking, Time etc there is no event fired when the device is connected to a network (except for an ActiveSync or WMDC connection).

You need to write your own thread that watches the connected count of the device netwrok state.

There are already examples about checking connection state:

https://msdn.microsoft.com/en-us/library/aa446548.aspx

Detecting network state (connected - disconnected) in C#

and more ....

Community
  • 1
  • 1
josef
  • 5,951
  • 1
  • 13
  • 24