What is the difference between a Listener and a Receiver (Android)?

前端 未结 4 1045
余生分开走
余生分开走 2020-12-25 13:12

For instance, I need a BroadcastReceiver to get these events:

REBOOT or SHUTDOWN

SCREEN ON or OFF

battery status (voltage, plugged in, temperature)

4条回答
  •  执笔经年
    2020-12-25 13:26

    Broad Cast Receiver is like Sigma and Event Listener is like Integration in mathematics both are summation ...

    • Sigma:Use this when we need the summation in discrete inter well ....
    • Integral:Use this when we need the continuous Summation ...

    In the same way both Broad Cast Receiver and Event Listener are used for Event Listening.But Broad Cast receiver is used for listening the very important events like BATTERY_CHANGED,BATTERY_LOW,BOOT_COMPLETED,CALL ETC and Event Lister updates Continuous changes in the event like LOCATION CHANGED,FOCUS GAINED ETC.

提交回复
热议问题