如何阅读的wpa_supplicant.conf文件 [英] how to read wpa_supplicant.conf file
本文介绍了如何阅读的wpa_supplicant.conf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能帮我读通过Android应用编程在Android设备 /data/misc/wifi/wpa_supplicant.conf
文件。
Can anyone help me to read /data/misc/wifi/wpa_supplicant.conf
file in android device through android app programmatically.
我试过低于code读取存储在的wpa_supplicant.conf
文件信息,并返回一个没有显示textview.but信息。
I tried the below code to read information stored in wpa_supplicant.conf
file and display information in a textview.but it returns nothing.
try
{
Process psProc = Runtime.getRuntime().exec(new String[]{"su","-c"});//root
File path=Environment.getDataDirectory();
File myFile = new File("/data/misc/wifi/wpa_supplicant.conf");
FileInputStream fIn = new FileInputStream(myFile);
BufferedReader myReader = new BufferedReader(
new InputStreamReader(fIn));
String aDataRow = "";
String aBuffer = "";
while ((aDataRow = myReader.readLine()) != null) {
aBuffer += aDataRow + "\n";
}
tv.setText(aBuffer);
myReader.close();
Toast.makeText(getBaseContext(),"Done reading SD 'TextAreaAppender.java'",
Toast.LENGTH_SHORT).show();
}
catch (Exception e)
{
Toast.makeText(getBaseContext(), e.getMessage(),Toast.LENGTH_LONG).show();
tv.setText(e.getMessage());
}
TextView中显示任何内容。
Textview displays nothing.
推荐答案
请确保您有重新挂载分区。否则,你无权进行读/写在这里。
Please make sure you have remount the partition. Otherwise, you have no permission to read / write here.
您可以尝试在该文件夹然后再进一步操作如下。
You can try following before further operation on that folder.
Runtime.getRuntime().exec("system/bin/mount -o rw,remount -t rootfs /data");
Runtime.getRuntime().exec("system/bin/chmod 777 /data/misc/wifi");
这篇关于如何阅读的wpa_supplicant.conf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文