locked
Daily sync of medium amount of data. How to realize with Windows Store App?

    Question

  • Hi,

    We are going to develop a new Windows Store App. In this app, medium amount of data should be synchronized between a WebService and the App. The downloaded data will be stored locally.

    The data should be synchronized once per day (ie at 2am), so that the User can access the offline data immediately afterwards.

    I've looked at the mechanisms possible in the Windows Store apps (TimeTrigger, BackgroundDownloader), but they all have pretty high restrictions.

    So my question is:

    Is it possible to run a TimeTrigger, which runs at 2am in the morning and starts a BackgroundDownloader to download a (delta)-file from the WebService and import it to the local storage? Or must the download finish within the restriction limit (2 seconds I think).

    Best regards

    Martin 

    Wednesday, October 29, 2014 2:24 PM

Answers

  • Hi Martin,

    Based on my knowledge, you are using the correct way for synchronized data. TimerTrigger class can help us to execute a task at a particular time. BackgroundDownloader class is primarily designed for long-term transfer operations for resources. So there is no time restriction limit with BackgroundDownloader class.

    If you still have questions, please post more information about your scenario.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.


    Thursday, October 30, 2014 7:30 AM
    Moderator
  • The BackgroundDownloader is managed by the OS and is therefore free of the time limit. However there still are scenarios where the user could prevent the download (e.g. the restrict background data option in DataSense is active and the metered (mobile) connection is above the data limit.

    The BackgroundDownloader however only downloads the file and places it in the App's local storage. You would need another background task to do the actual merging between delta file and your regular data store. This is tricky as there is no trigger for a download being finished and on a bad connection it can be hard to predict when the download has finished - e.g. you start the Download at 2 am and try to merge at 2:01 am but the phone is on a slow connection, the download has not yet finished so you can't do a successful merge.

    I have not found information wether or not you can start a BackgroundDownload from a triggered background Task, so I guess it's possible but I have not done that myself yet.

    • Marked as answer by pum.m Thursday, October 30, 2014 2:12 PM
    Thursday, October 30, 2014 8:32 AM

All replies

  • Hi Martin,

    Based on my knowledge, you are using the correct way for synchronized data. TimerTrigger class can help us to execute a task at a particular time. BackgroundDownloader class is primarily designed for long-term transfer operations for resources. So there is no time restriction limit with BackgroundDownloader class.

    If you still have questions, please post more information about your scenario.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.


    Thursday, October 30, 2014 7:30 AM
    Moderator
  • The BackgroundDownloader is managed by the OS and is therefore free of the time limit. However there still are scenarios where the user could prevent the download (e.g. the restrict background data option in DataSense is active and the metered (mobile) connection is above the data limit.

    The BackgroundDownloader however only downloads the file and places it in the App's local storage. You would need another background task to do the actual merging between delta file and your regular data store. This is tricky as there is no trigger for a download being finished and on a bad connection it can be hard to predict when the download has finished - e.g. you start the Download at 2 am and try to merge at 2:01 am but the phone is on a slow connection, the download has not yet finished so you can't do a successful merge.

    I have not found information wether or not you can start a BackgroundDownload from a triggered background Task, so I guess it's possible but I have not done that myself yet.

    • Marked as answer by pum.m Thursday, October 30, 2014 2:12 PM
    Thursday, October 30, 2014 8:32 AM
  • Hello.

    Thank you two for your information.

    I've created a tiny prototype to test the behavior and yes, it seems to work. I can download a file (2MB size) without any problems.

    Regarding the BackgroundDownloader: I thought there are possibilities to check if the download is finished (ie checking downloadprogress or getting responseinformation). Nonetheless I dont know if I even have enough time to migrate the data in the Background Task. But in the worst case, I just need to migrate the data if the user starts the app. I'll just check if there is a new file and start migrating. This should be fast enough, because we have quite beefy Surface Pro 3 as target platform ;)

    Thank you again for your help!

    Thursday, October 30, 2014 2:12 PM