Android service to listen on a specific port

I want to know how to install an android service that listens on a specific port, for example. http://127.0.0.1:12345

+4
source share
1 answer

Add your service and use the ServerSocket class to listen for and act on incoming connections. However, do not call ServerSocket.accept() in the UI thread. This will cause your application to not respond. Instead, create a new thread, or depending on your actual scenario, perhaps AsyncTask .

+4
source

All Articles