Recently I need to Accelerate the scan speed of wifi, so I use the tool of Iwlist and Iwconfig. downloaded from :https://github.com/nvamelichev/wireless-tools-android
After Compiling, I put these two binary file to /system/xbin/ with proper permission. It works fine on the app of "Terminal emulator" but when I try to execute them in my own app. it does not work.... Here is my code:
iwProcess = Runtime.getRuntime().exec("iwlist --version");
BufferedReader reader = new BufferedReader(new InputStreamReader(
iwProcess.getInputStream()));
int read;
char[] buffer = new char[4096];
StringBuffer output = new StringBuffer();
while ((read = reader.read(buffer)) > 0) {
output.append(buffer, 0, read);
}
reader.close();
iwProcess.waitFor();
String nativeOutput = output.toString();
mTextView.setText(nativeOutput);
StringBuffer sb = new StringBuffer();
BufferedReader br = new BufferedReader(new InputStreamReader(
iwProcess.getErrorStream()));
while ((read = br.read(buffer)) > 0) {
sb.append(buffer, 0, read);
}
br.close();
mTextView.setText(output + sb.toString());
the result is "socket address family not supported by protocol" that really confuse me....