Do Android permissions allow listeners on ports >1024 without special root permissions (only standard in-app permissions)



  • I'm not an Android developer, I am a developer in many other contexts.

    I have a simple question that I don't see an answer to on Google: Can a standard android application (no rooting required) listen to a socket on a high numbered port? E.e. only using standard in-app permissions?

    Any reference to the documentation on the available permissions would be a nice addition for this weekend warrior Android coder to-be.



  • Android bases on Linux and thus has the same limitations that the root permissions are required to open a socket on ports below 1024.

    For opening a socket in an app on a port greater than or equal to 1024 the app itself needs to have the static permission:

     
    

    defined in its AndroidManifest.xml. Without that permission no network communication is allowed by the Android operating system. With the permission you can open client and server sockets to perform network operations as usual.

    When opening a socket for running a server, be aware that usually this only makes sense on the WiFi interface. On the mobile network interface you can open up a socket, but as mobile network providers don't assign a public IP, you can't reach a server running on a Android system connected via mobile data to the Internet.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2