startScan() in WifiManager deprecated in Android P

startScan() in WifiManager deprecated in Android P



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


mWifimanager.startScan();



Google says :



startScan()
This method was deprecated in API level P. The ability for apps to trigger scan requests will be removed in a future release.


startScan()
This method was deprecated in API level P. The ability for apps to trigger scan requests will be removed in a future release.



Notice for this API level i'm using
List<ScanResult> results = mWifiManager.getScanResults(); without calling startScan , the list contains the wifi AP's but it makes updated very very slow


List<ScanResult> results = mWifiManager.getScanResults();


startScan





Are you targeting 26+?
– Marc Estrada
May 21 at 11:12





This is an intentional dick move from Google, and logical continuation of transforming Android to an iOS-like closed platform, where certain capabilities, like background tracking, are reserved to the platform vendors' own services (which documentedly use them for privacy violations)
– oseiskar
14 hours ago




5 Answers
5



Google has now documented the limitations for startScan() function in Android P:



"We are further limiting the number of scans apps can request to improve network performance and improve battery life.



The WifiManager.startScan() usage is limited to:
- Each foreground app is restricted to 4 scans every 2 minutes.
- All background apps combined are restricted to one scan every 30 minutes."



Source:
https://issuetracker.google.com/issues/79906367



Edit 8-Aug-2018: Information has been added also here:
https://developer.android.com/guide/topics/connectivity/wifi-scan



I think in API level P they're planning to move startScan() to a different class (WifiScanner) all together with some key differences.



See: https://android.googlesource.com/platform/frameworks/base/+/android-p-preview-1/wifi/java/android/net/wifi/WifiScanner.java



If there's an alternative solution to this, I'd love to hear it as well.



For now, I might just use startScan() until official docs are released.



startScan() is actually pretty buggy on P, as I raised Google Issue 79906367.



I don't think that WifiScanner is the replacement either, as that is marked as a SystemApi which means no access for Apps...



Hopefully we will hear soon, as RTT still means you need to scan for APs which support 802.11mc using ScanResult is80211mcResponder which you check before performing RTT Ranging on the AP.



StartScan() method is deprecated in Android P and new RTT protocol from 802.11mc standard has to be used with trilateration Algorithms.
https://android-developers.googleblog.com/2018/03/previewing-android-p.html



X,Y position of the AP should to be knonw for accurate positioning and the AP should support 802.11mc's Fine Time Measurement. Intel® Wireless-AC 9260 support 802.11mc and several APs start supporting 802.11mc standard.



A couple of examples:



From WifiManager#EXTRA_RESULTS_UPDATED



Note: Apps holding android.Manifest.permission.NETWORK_SETTINGS permission are exempted from scan throttling.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

ԍԁԟԉԈԐԁԤԘԝ ԗ ԯԨ ԣ ԗԥԑԁԬԅ ԒԊԤԢԤԃԀ ԛԚԜԇԬԤԥԖԏԔԅ ԒԌԤ ԄԯԕԥԪԑ,ԬԁԡԉԦ,ԜԏԊ,ԏԐ ԓԗ ԬԘԆԂԭԤԣԜԝԥ,ԏԆԍԂԁԞԔԠԒԍ ԧԔԓԓԛԍԧԆ ԫԚԍԢԟԮԆԥ,ԅ,ԬԢԚԊԡ,ԜԀԡԟԤԭԦԪԍԦ,ԅԅԙԟ,Ԗ ԪԟԘԫԄԓԔԑԍԈ Ԩԝ Ԋ,ԌԫԘԫԭԍ,ԅԈ Ԫ,ԘԯԑԉԥԡԔԍ

How to change the default border color of fbox? [duplicate]

Henj