I want to replicate the status bar behavior on my own when connected to WiFi.
I've registered a receiver, but i don't know what exact action i suppose to listen to be able to detect if I am connected to WiFi AP, but it has no internet connection on it (hotspot disconnected).
I was trying with:
override fun onReceive(context: Context, intent: Intent) {
val wifiState = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, DEFAULT_WIFI_STATE_VALUE)
wifiStateSubject.onNext(wifiState)
Timber.d("Current wifi state: $wifiState")
}
But it doesn't get me any valuable information when i was connected to my hotspot which was disconnected from the network.
I want to be able to detect and show exclamation mark on my own when i am connected to WiFi AP, but no internet connection.
Is there a specific action to which i should register with my receiver using WiFiManager
action?