In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to achieve Android mobile phone through WIFI and PC connection, the article is very detailed, has a certain reference value, interested friends must read it!
1. Pass in the program
Runtime.getRuntime () .exec (su)
Get the root permission for the phone (the phone must be after root).
two。 Restart adbd
Exec ("stop adbd"); exec ("start adbd")
3. Establish a connection with PC (I handled it through the bat file process)
/ * Mobile phone connects to wifi. * * @ param host Mobile ip: Port number. For example: 192.168.10.124 ParseProperties.getProperties 8888 * / public int connectWifi (String host) {String cmd = ParseProperties.getProperties ("dir") + "bin/ConnectWifi.bat" + host; BufferedReader reader = null; int retcode = 0; try {Process process = Runtime.getRuntime () .exec (cmd) Reader = new BufferedReader (new InputStreamReader (process.getInputStream (); @ SuppressWarnings ("unused") String line = null; String returnLine = null; System.out.println ("*") While ((line = reader.readLine ())! = null) {if (line! = null) returnLine = line; System.out.println (line);} if (returnLine.trim (). StartsWith ("connected to")) {retcode = SUCCESS } else if (returnLine.trim (). StartsWith ("already connected to")) {retcode = SUCCESS;} else {retcode = FAILE;} System.out.println ("*") } catch (IOException e) {e.printStackTrace (); retcode = FAILE;} finally {if (reader! = null) {try {reader.close () } catch (Exception e) {e.printStackTrace ();} if (retcode = = 0) {retcode = FAILE;} return retcode;}
Bat file
The internal use in the bat file is simple adb connect 1
Through the above method, you can connect with PC through wifi. Note: the mobile phone and PC should be in the same local area network.
The above is all the contents of the article "how to connect Android phones through WIFI and PC". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.