 <p>You are explicitly setting <code>receiver</code> to null inside <code>toggleButton.setOnClickListener</code> and in <code>onPause</code>:</p> <pre><code>receiver = null; </code></pre> <p>Try removing those lines and see if it fixes the issue</p>