Broadcast Receiver class and registerReceiver method

前端 未结 3 845
春和景丽
春和景丽 2020-11-30 05:53

Hi i am trying to understand Broadcast Receiver , i went through many sample codes , but still have some doubts. I wanted to know when we have to extend the Broadcast Receiv

3条回答
  •  自闭症患者
    2020-11-30 06:46

    In both case you are creating object.But in first case there is not any reference for the receiver object so it can not be unregistered later but second one has so it can be unregistered after registering object using below methods:

    registerReceiver(intentReceiver );
    unregisterReceiver(intentReceiver );
    

提交回复
热议问题