WifiManager.getScanResults() - clarifications (automatic scans, sleep etc)

后端 未结 2 530
长发绾君心
长发绾君心 2020-12-20 05:32

I would like some clarifications on the behavior of WifiManager.getScanResults(), namely :

When wireless is enabled

  1. Does android
相关标签:
2条回答
  • 2020-12-20 06:17

    When wireless is disabled

    1. getScanResults() will return null...
    2. ...even after a reboot (that's to be expected - this would be disputed if it did not return null in the first place)

    When wireless is enabled

    2.Surprisingly enough getScanResults() will return null after some time (on a Nexus One, Android 2.3.7, Cyanogen mod - but I suspect this is not really relevant). So yes, apparently one has to initiate a scan irrespective of the wireless status

    I guess this is true also if the state is WIFI_STATE_DISABLING

    I am still interested in the answer in the case wireless is enabled - in particular question 2, if the device is asleep. Google groups won't let me post (hint)

    0 讨论(0)
  • 2020-12-20 06:25

    public List getScanResults ()

    Added in API LEVEL 1

    Return the results of the latest access point scan.

    Returns the list of access points found in the most recent scan. An app must hold ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in order to get valid results.

    0 讨论(0)
提交回复
热议问题