I am using NanoHttpd to create a WebServer on the device (I may want to use it only for my Application or allow other applications to use it).
But I am having to provide permission INTERNET.
I have created an application that does this and it works only when I provide android.permission.INTERNET
in the manifest.
My code actually works, but when I don't provide INTERNET permission I am getting exception in logcat:
Caused by: java.net.SocketException: socket failed: EACCES (Permission denied)
at java.net.ServerSocket.createImpl(ServerSocket.java:308)
at java.net.ServerSocket.getImpl(ServerSocket.java:258)
at java.net.ServerSocket.setReuseAddress(ServerSocket.java:716)
at fi.iki.elonen.NanoHTTPD.start(NanoHTTPD.java:2319)
at cc.siara.android.NanoHttpServer.<init>(NanoHttpServer.kt:16)
at cc.siara.android.App.onCreate(App.kt:23)
I don't want to provide Internet permission because I want to assure user about the privacy my application provides.
All I want to access is http://127.0.0.1:<port>
. Is it possible?