Skip to content

Commit

Permalink
change unregisteReceiver to OnDestory
Browse files Browse the repository at this point in the history
  • Loading branch information
laufly committed Jan 17, 2018
1 parent 8637445 commit 1f76479
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public void onReceive(Context context, Intent intent) {
}
}
};
IntentFilter intentFilter = new IntentFilter(Constant.INVITE_CANCEL);
registerReceiver(broadcastReceiver, intentFilter);
llAccept.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand All @@ -81,9 +83,11 @@ public void onClick(View v) {
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(broadcastReceiver);
if (RingUtil.isRing) {
RingUtil.stop();
}

}

private void startRing() {
Expand All @@ -93,13 +97,10 @@ private void startRing() {
@Override
protected void onResume() {
super.onResume();
IntentFilter intentFilter = new IntentFilter(Constant.INVITE_CANCEL);
registerReceiver(broadcastReceiver, intentFilter);
}

@Override
protected void onPause() {
super.onPause();
unregisterReceiver(broadcastReceiver);
}
}

0 comments on commit 1f76479

Please sign in to comment.