Last active
June 16, 2022 12:06
-
-
Save mazzouzi/bb8c5145df213f00fecc86c786b62159 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AndroidApiLeakFragment : Fragment() { | |
private lateinit var localBroadcastReceiver: BroadcastReceiver | |
var wifiStateChanged = false | |
override fun onStart() { | |
super.onStart() | |
registerBroadCastReceiver() | |
} | |
private fun registerBroadCastReceiver() { | |
localBroadcastReceiver = object : BroadcastReceiver() { | |
override fun onReceive(context: Context?, intent: Intent?) { | |
wifiStateChanged = true | |
} | |
} | |
activity?.registerReceiver( | |
localBroadcastReceiver, | |
IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION) | |
) | |
} | |
. | |
. | |
. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment