Search code examples
androidhttpservernanohttpd

Should httpserver run as an Android Service or as an Android application?


I have an Android Service that starts up an admin Android application at boot time. Note that I cannot do away with the app as I need it for admin interaction.

The Android Service + app is the server to around 10 Android clients over a LAN connection. I plan to use nanohttpd (a very light-weight http server) to act as http server for communication with the clients. Now, the question is, should I implement nanohttpd in the Service part or in the app part of the server? What is the best approach?


Solution

  • Definitely use Service, they are just exactly what you need - a lot of work in the background.