title: Register receiver to handle notification button
body: <p>I am trying to handle notification bar click on Android.
  I created a class that extends BroadcastReceiver on my service.</p>
  
  <pre><code>public class SwitchButtonListener extends BroadcastReceiver {
      @Override
      public void onReceive(Context context, Intent intent) {
          Log.i("PlayService", "EVENT");
      }
  }
  </code></pre>
  
  <p>Then i do:</p>
  
  <pre><code>switchButtonListener = new SwitchButtonListener();
  registerReceiver(switchButtonListener, new IntentFilter("com.example.spotifytest.actions"));
  Intent intentPlayPause = new Intent("com.example.spotifytest.actions");
  PendingIntent pendingIntentPlayPause = PendingIntent.getBroadcast(this, 0, intentPlayPause, 0);
  contentView.setOnClickPendingIntent(R.id.btPlayPause, pendingIntentPlayPause);
  </code></pre>
  
  <p>Nothing fires.. It works when i register the broadcast on the manifest, but i don't want my Listener class to be static.</p>
  
  <p>Regards !</p>