BroadcastReceiver Tutorial Part 3 – CUSTOM BROADCASTS – Android Studio Tutorial
In part 3 of the BroadcastReceiver tutorial, we will send and receive an implicit custom broadcast with an intent action string that we define ourselves. The same as system broadcast our custom broadcast can contain extra data, which we add by calling putExtra on the intent and passing a value together with a name. We then pass our intent to the sendBroadcast method, which will send the broadcast immediately and trigger all BroadcastReceivers that were registered dynamically with the registerReceiver method.
To access the variables in our Activity, we can add the BroadcastReceiver as an inner class and update the UI in it’s onReceive method directly.
Watch the whole playlist:
Example code for this part:
https://gist.github.com/codinginflow/655fbbe549f08e9f7787fbae16b6003f
____________________
💻 Find the BEST programming tutorials on TutHub:
https://tuthub.io
⭐ Get my MVVM Caching Course now:
https://codinginflow.com/caching
❗ Subscribe to the channel:
https://www.youtube.com/c/codinginflo…
📨 Subscribe to the Coding in Flow newsletter:
https://codinginflow.com/newsletter
❓ Join our free developer community:
https://discord.gg/TSnMvmc
📣 Follow Coding in Flow on other sites:
Facebook: https://www.facebook.com/codinginflow
Instagram: https://www.instagram.com/codinginflow
TikTok: https://www.tiktok.com/@codinginflow
Twitter: https://twitter.com/codinginflow
Github: https://github.com/codinginflow
💰 Business requests, sponsoring, etc.: info@codinginflow.com
Views :43373
android studio