Monday, June 18, 2012

Re: [android-developers] Re: adb shell command from java code

Thnk u so much.

On Fri, Jun 15, 2012 at 8:09 PM, Nobu Games <dev.nobu.games@gmail.com> wrote:
Hi, you should take a look at WifiManager.getConfiguredNetworks() and WifiManager.getConnectionInfo() for getting the assigned WLAN IP address the clean way.

Other than that netcfg is just a program available on the phone. There is no direct connection to adb which runs on your development PC. Out of curiosity I tried running that command on my Samsung Galaxy S with success. You can try following source code:

        try {
            Process process = Runtime.getRuntime().exec("netcfg");
            InputStreamReader reader = new InputStreamReader(process.getInputStream());
            Scanner scanner = new Scanner(reader);

            while(scanner.hasNextLine()) {
                Log.d("netcfg", scanner.nextLine());
            }

            scanner.close();
        } catch(IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



--
G Loka Sudharsan Reddy
Third year Undergraduate Student
Department of Electronics and Electrical Communication Engineering
Indian Institute of Technology Kharagpur

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate