Sobes.tech
Junior — Middle

What is the role of the BroadcastReceiver component in Android and why is it used?

sobes.tech AI

Answer from AI

BroadcastReceiver in Android is a component that allows an application to respond to system or user broadcast messages. It is used to handle events such as network state changes, receiving SMS, device charging, and others.

Example: an application can use BroadcastReceiver to trigger specific code when connected to Wi-Fi.

This enables applications to operate asynchronously and respond to events without constantly running activities or services.