Hi, you should take a look at
WifiManager.getConfiguredNetworks()<http://developer.android.com/reference/android/net/wifi/WifiManager.html#getConfiguredNetworks%28%29>and
WifiManager.getConnectionInfo()<http://developer.android.com/reference/android/net/wifi/WifiManager.html#getConnectionInfo%28%29>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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en