You bind in onResume
but unbind in onDestroy
. You should do the unbinding in onPause
instead, so that there are always matching pairs of bind/unbind calls. Your intermittent errors will be where your activity is paused but not destroyed, and then resumed again.