0

Can i run any code from WP8.1 universal app in background when device connect to internet? For example user work with app, but have no internet connection. App save data into local storage, user close app, then user come home and phone automatically connect to WiFi, can I run my code in bacground in this moment and for example upload data to ftp server

Std_Net
  • 1,076
  • 3
  • 12
  • 25

2 Answers2

1

You should be able to do this with SystemTrigger.NetworkStateChanged. Though, you must remember that there are some limits for using network in BackgroundTask - more about constraints you will find at MSDN.

For some help you may also take a look at this answer, you will also find a sample code there.

As for adding a BackgroundTask, take a look at MSDN, this blog post or this SO answer.

Community
  • 1
  • 1
Romasz
  • 29,662
  • 13
  • 79
  • 154
0

This link might give you some hints on how do add some conditions to the BackgroundTask. On the same page, you will find additional links on the bottom for using BackgroundTasks.

VasileF
  • 2,856
  • 2
  • 23
  • 36