Skip to content

Commit

Permalink
Fix duplicate politeia notification listener error (planetdecred#540)
Browse files Browse the repository at this point in the history
An error that causes the app to crash occurs when multiple notification
listeners are added with the same key. This occurred because a notification
listener added previously in the app onResume was not removed in onStop
which can happen if the OS fails to call onStop. This error is avoided by
removing any notification listener added with the key before adding a new
notification listener.
  • Loading branch information
beansgum committed Apr 21, 2021
1 parent 0e1db85 commit ef51bb6
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class PoliteiaActivity : BaseActivity(), ProposalNotificationListener,

override fun onResume() {
super.onResume()
multiWallet!!.politeia.removeNotificationListener(this.javaClass.name)
multiWallet!!.politeia.addNotificationListener(this, this.javaClass.name)
}

Expand Down

0 comments on commit ef51bb6

Please sign in to comment.