如何以编程方式获取热点(AP)中的连接设备数[Android]
我正在开发一个需要显示热点详细信息的应用程序,包括连接到热点的设备数量 我试过了,但没有成功如何以编程方式获取热点(AP)中的连接设备数[Android],android,android-wifi,android-networking,Android,Android Wifi,Android Networking,我正在开发一个需要显示热点详细信息的应用程序,包括连接到热点的设备数量 我试过了,但没有成功 private int countNumMac() { int macCount =0; BufferedReader br = null; try { br = new BufferedReader(new FileReader("/proc/net/arp")); String line;
private int countNumMac()
{
int macCount =0;
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader("/proc/net/arp"));
String line;
System.out.println(br.toString());
while ((line = br.readLine()) != null) {
String[] splitted = line.split(" +");
System.out.println("splitted :"+splitted);
if (splitted != null && splitted.length >= 4) {
// Basic sanity check
String mac = splitted[3];
if (mac.matches("..:..:..:..:..:..")) {
macCount++;
}
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if(macCount == 0)
return 0;
else
return macCount-1;
}
是否有其他方法来计算连接到热点的设备数量