java - Enable port 5555 for adb network admining programmatically -


i wondering how can enable port 5555 daemon adb on android? basically, have been setting home network old router can keep devices connected. here's issue: don't want have connect usb every time enable ports, defeats whole purpose.

i wondering how forward port using java or jni programmatically clicking button? have seen telnetd app it. want myself. how achieve this? have tried 1 function, here is:

public void openport()     {         try          {             java.lang.process process = runtime.getruntime().exec("setprop service.adb.tcp.port 5555");             int exitcode = process.waitfor();             if (exitcode != 0)              {                 throw new java.io.ioexception("command exited " + exitcode);             }             runtime.getruntime().exec("adb tcpip 5555");             toast.maketext(this, "listening on port "+ port + "...", toast.length_long).show();         }          catch (exception ex)          {             ex.printstacktrace();             toast.maketext(this, "an error has occurred: " + ex, toast.length_long).show();             port++;             openport();         }     } 

now never reaches exception, says opened on port, when go connect via network not work. how can this?

keep in mind, app moved system app lucky patcher, system app. if matters.

(posted solution on behalf of op).

i changed bit. works now:

public void openport() {     try      {         string cmds[] = {             "setprop service.adb.tcp.port 2222",             "stop adbd",             "start adbd"         };         (int = 0; < cmds.length; i++)         {             java.lang.process process = runtime.getruntime().exec(cmds[i]);             int exitcode = process.waitfor();             if (exitcode != 0)              {                 throw new java.io.ioexception("command exited " + exitcode);             }         }         toast.maketext(this, "listening on port 2222...", toast.length_long).show();     }      catch (exception ex)      {         ex.printstacktrace();         toast.maketext(this, "an error has occurred: " + ex, toast.length_long).show();         openport();     } } 

Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -