i just did a test on an app, my code does not have wifiManager.startScan(); , only wifiManager.getScanResults(); , it uses location service to scan for wifi and not using the wifi settings, can anybody explain why it uses location service to scan for wifi instead and why wifiManager.startScan(); is not needed?
Asked
Active
Viewed 143 times
0
-
Which Android Version do you use? Because startScan() was deprecated in API28 and I guess that the system does this for you now. -> https://developer.android.com/reference/android/net/wifi/WifiManager.html#startScan() – Christopher Sep 27 '18 at 06:08
-
i compile my app using compilesdkversion 28 but my tablet is using android 7.0.0 which is 23 – Joshua Tan Sep 27 '18 at 06:16
-
@Christopher any idea why it uses location service to scan for wifi? just curious – Joshua Tan Sep 27 '18 at 06:18
-
so since startScan() was deprecated, the system does it for me without applying the function? – Joshua Tan Sep 27 '18 at 06:20
-
Sorry, I don't understand what you mean by this? Can you share your code as I don't understand your question fully. – Christopher Sep 27 '18 at 06:21
-
Regarding startScan(): https://stackoverflow.com/questions/49178307/startscan-in-wifimanager-deprecated-in-android-p – Christopher Sep 27 '18 at 06:23
-
so basically we dont need to have a startScan() function before getScanResults? – Joshua Tan Sep 27 '18 at 06:26
-
Not sure about this one, but you can still request a startScan(), but the usage is limited: https://developer.android.com/guide/topics/connectivity/wifi-scan – Christopher Sep 27 '18 at 06:34
-
i see, just want to clear my curiosity, as im still able to get results from getScanResults even without doing a startScan(); , therefore my curiosity – Joshua Tan Sep 27 '18 at 06:35