Android Scan for Wifi networks

前端 未结 5 707
北荒
北荒 2021-02-02 04:33

I\'m trying to scan for wireless networks and found this helpful source on the net. Unfortunately it\'s not working and I have no idea why. My problem is that I can\'t wait 10 m

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-02 05:08

    You should write in BroadcastReceiver like this:

    1. Register it
    2. Then startScan and do like this

      if (WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.equals(action)) {
      
      super.onReceive(context, intent);           
      //Scan is ok, just need few seconds!
      }
      

提交回复
热议问题