socketswindows-phone-8backgroundserverbackground-agents

Keep StreamSocketListener running in background on Windows Phone 8


I want to run a server on Windows Phone 8. It is important that the server keeps running even if the user opens another app or the screen lock turns on. Relying on an internet connection is not an option. It should work in a local network.

UseCase: The server is needed for a multiplayer game. The idea is that one player starts a local server. After that, all players (including the player who starts the local server) can connect to this server using a webbrowser. The server delivers html and responds to ajax calls.

It seems that PeriodicTask and ResourceIntensiveTask do not fit my needs. Is that correct? How can I run an app in the background that is always listening for incoming tcp connections?


Solution

  • I don't know a clean way. But if you're happy with a hack: You could use the Geolocator. This blog gives a step by step guidance: How to create application which executes in the background on Windows Phone 8?

    As most of the hacks, this brings some problems and questions (probably more than I mention here):