Skip to content

Instantly share code, notes, and snippets.

@gpeal
Created March 14, 2021 02:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpeal/4e32059a68f2984e01fc64707a7d79c1 to your computer and use it in GitHub Desktop.
Save gpeal/4e32059a68f2984e01fc64707a7d79c1 to your computer and use it in GitHub Desktop.
Broadcast Receiver
context.registerReceiverInScope(scope, WifiManager.WIFI_STATE_CHANGED_ACTION) { intent ->
val state = intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, WifiManager.WIFI_STATE_DISABLED)
// Use wifi state here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment