0
votes

I have a Windows Phone Silverlight 8.1 App and I'd like to add a Background task that uploads some data every 30 minutes if there is internet connectivity. I followed the steps to create a Background task in Windows Phone 8.1 but I cannot create a Windows Runtime component as per https://msdn.microsoft.com/en-us/library/windows/apps/dn642084(v=vs.105).aspx - (Silverlight 8.1 apps can’t use Managed Windows Runtime components). So I put the classes needed in a Silverlight class library and everything works until you launch the Background task. The App crashes and no error shows in the debug session. I know background tasks should be supported as per https://msdn.microsoft.com/en-us/library/windows/apps/dn642080(v=vs.105).aspx - (Background tasks Supporting your app with background tasks (Windows Store apps using C#/VB/C++ and XAML)).

Am I missing something obvious or is there no way of performing Background tasks in a Windows Phone Silverlight 8.1 app?

2

2 Answers

0
votes

Managed to solve this issue by creating a new Silverlight 8.1 project from scratch and copying over all the files from my old project. This project had been retargeted from a Windows 8.1 project and probably something was left there that was causing the crash. Both links referenced in my question are valid as you need to reference the Managed Windows Runtime component but not use it from the Silverlight 8.1 App.

0
votes

Try to do the same using a project with type: Windows Phone Scheduled Task Agent, you could implement a periodic task with this.

I hope it helps you, If you need some help, please let me know.

Regards