BroadCastReceivers Vs CallBackListeners

After I worked with BroadCastreceivers

networking, the question arose as BroadCastreceivers

it almost works as if they listen for any system changes and notify the user of those changes only if the user is registered to listen for these system change events with RegisterReceiver()

. Question:

What is the difference between broadCastReceiver

used in Connectivity Manager

and CallbackListeners

used in LocationManager

, or, in other words, why LocationManager

not use `broadCastReceiver and vice versa?

+3


source to share


1 answer


CallbackListener

will be used when youre code initiates an asynchronous call and waits for a response.



broadCastReceiver

will be used when something might happen unexpectedly and at any time

+1


source







All Articles