【问题标题】:Get a notification when client connects to access point?当客户端连接到接入点时收到通知?
【发布时间】:2013-12-04 12:48:21
【问题描述】:

我有一个问题:

当客户端连接到我之前打开的 Wifi 接入点时,为什么要在我的 MainActivity 中获得通知(意图、广播等)?

我想在连接时将有关已连接客户端的信息打印到控制台。

感谢您的帮助!

【问题讨论】:

    标签: android networking wifi android-wifi


    【解决方案1】:
    try {
        br = new BufferedReader(new FileReader("/proc/net/arp"));
        String line;
        while ((line = br.readLine()) != null) {
            String[] splitted = line.split(" +");
            if (splitted != null && splitted.length >= 4) {
                String mac = splitted[3];
                if (mac.matches("..:..:..:..:..:..")) {
                    macCount++;
                } 
            }
        }
    } catch (Exception e) { e.printStackTrace();
    } finally {
        try {
            br.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2014-02-11
      • 2014-01-21
      • 1970-01-01
      • 2018-03-23
      • 1970-01-01
      • 1970-01-01
      • 2020-07-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多