startScan() in WifiManager deprecated in Android P

前端 未结 7 2109
没有蜡笔的小新
没有蜡笔的小新 2020-12-08 05:02

How to get scan result from wifi for example every 3 seconds, without mWifimanager.startScan();

Google says :

startScan() This method was

7条回答
  •  余生分开走
    2020-12-08 05:28

    It appears Googles intention might be to force developers to use WifiRttManager instead for indoor location atleast [1]. Or rely on usual Google Play location services, which is an option in some use cases, but definitely not all. It's optimised for the average use case. No use case is the average use case.

    Unfortunately with the way WifiRttManager calculates location it requires the wifi accesspoints to have 802.11mc. However you don't need to connect to these points. Virtually 0 routers today have this standard. [2] [3] [4] With 3 access points you can get location close to 1-2m accuracy.

    Who knows if they'll place restrictions on this functionality as well though. There is simply no excuse for taking this choice away from users and developers. Disgusting.

    So it appears there will atleast be a dark age for indoor location. Perhaps a workaround is to have devices you are connected to and ping them.

    [1] https://developer.android.com/reference/android/net/wifi/rtt/WifiRttManager

    [2] https://github.com/Plinzen/android-rttmanager-sample

    Additional reading

    [3] https://en.wikipedia.org/wiki/IEEE_802.11mc

    [4] https://fit-iot.com/web/wifi-indoor-positioning/

提交回复
热议问题