Ahmed Hegazy
Ahmed Hegazy

Reputation: 12615

Detect WIFI BSSID changes

Is it possible to detect BSSID changes in the same network with the same SSID ? so when your mobile switchs to another access point, it fires a broadcast receiver.

Upvotes: 2

Views: 872

Answers (1)

GenesisST
GenesisST

Reputation: 1335

yes, it is possible.

Create a BroadcastReceiver and register it to WifiManager action SUPPLICANT_STATE_CHANGED_ACTION.

In your onReceive, get the value of the WifiManager.EXTRA_NEW_STATE via intent.getParcelableExtra(). You can safely cast it to a SupplicantState object.

If the state is COMPLETED, you can get the BSSID from WifiInfo (WifiManager.getConnectionInfo).

Upvotes: 1

Related Questions