Background task in windows store App RRS feed

  • Question

  • I'm developing an application which communicates with REST services. I want to implement a background process/task which continues to run throughout the life-cycle of the application.

    Expected behavior of background process/task is it should monitor/listen the local DB(Sqlite) and whenever a record added to local db it sends it to Server using Restful APIs. Kinda synchronization.

    It may happen that the application gets disconnected from internet/network and let's assume few records were not synced due to N/W unavailability. So next time whenever N/W gets up the background process starts sending pending records to the server.

    Question: How can i achieve this? What topics should i explore to go in right direction?

    • Moved by CoolDadTx Friday, July 8, 2016 4:49 PM UWA related
    Friday, July 8, 2016 5:36 AM


  • First the REST serice must even implement push notifications. If it does not, all you can do is polling the thing.

    Secondly multithreading might be unessesary. What you need is multitasking. Multithreading just used to be the easiest way to go about doing Multitasking until async...await came around.
    Multithreading only helps with a CPU bound operation. Network operations are generally never CPU bound, so save yourself some hassle and go for multitasking.

    Thirdly you are asking for store apps. That implies .NET Core and UWP being used or at least Windows Runtime. We deal mostly with the much wider .NET Farmework, you need a specialsied Forum for your display technology. I have no idea if BackgroundWorker/thread even exists in .NET Core. So I am not even sure you are on the right Forum - a mobile development one might be better.
    You can read up on the differences here:
    Frameworks, Programming for .NET, Display technologies and the like

    • Edited by Christopher84 Friday, July 8, 2016 11:25 AM
    • Proposed as answer by Sunteen Wu Wednesday, July 20, 2016 8:39 AM
    • Marked as answer by Barry Wang Thursday, July 21, 2016 9:08 AM
    Friday, July 8, 2016 11:25 AM