Receive notifications when a new access point is detected?

Does Android provide a notification of what's next to the new Wi-Fi network? Regardless of whether the device is configured to connect to this Wi-Fi network, does the device depend on the Wi-Fi configuration for a particular Wi-Fi network, but is it possible to receive a notification when you enter any new Wi-Fi network?
I saw the WifiManager class, but the states inside the class do not seem to achieve what I am trying to do. Any ideas?

+3
source share
1 answer

Use BroadcastReceiverregistered for the intentions with action: WifiManager.NETWORK_STATE_CHANGED_ACTION.

BroadcastReceiver NetworkInfo :

NetworkInfo ni = (NetworkInfo) intent.getParcelableExtra(WifiManager.EXTRA_NETWORK_INFO);

ni.getState(), / Wi-Fi-.

, ?


, , Wi-Fi- , WifiManager.getScanResults() Scanresult . SSID BSSID , mac.

, BroadcastReceiver, WifiManager.SCAN_RESULTS_AVAILABLE_ACTION. , Wi-Fi, , SSID (.. ) .

, , , , wifi- , WifiManager.startScan().

+7

Source: https://habr.com/ru/post/1776387/


All Articles