Created
October 4, 2022 15:33
-
-
Save devrath/5322f4d88e0f6ec12bd363b7589b9f7c to your computer and use it in GitHub Desktop.
Deprecated static broadcast reciever
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 CustomStaticBroadcastReceiver : BroadcastReceiver() { | |
override fun onReceive(context: Context?, intent: Intent) { | |
if (ConnectivityManager.CONNECTIVITY_ACTION == intent.action) { | |
Toast.makeText(context, "Connectivity changed", Toast.LENGTH_SHORT).show() | |
} | |
} | |
} |
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
<receiver android:name=".demos.static_receiver.reciever.CustomStaticBroadcastReceiver" | |
android:exported="false"> | |
<intent-filter> | |
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> | |
</intent-filter> | |
</receiver> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment