title: Android Notification Action is not fired (PendingIntent)
body: <p>I am trying to add an Notification action item in my app which is a music player. When a stream is started a notification should be triggered and an stop button for the stream should be displayed in the notfication. The notification working fine so far, I am having trouble with the stop action item. Here is how it is declared in the service starting the stream:</p>
  
  <pre><code>Intent stopIntent = new Intent(this, MusicPlayerNew.class);
  stopIntent.putExtra("STOP", "STOP");
  PendingIntent stopPendingIntent = PendingIntent.getActivity(this, 0,
                  stopIntent, PendingIntent.FLAG_UPDATE_CURRENT, null);
  mBuilder.addAction(R.drawable.ic_stat_stop, "Stop", stopPendingIntent);
  </code></pre>
  
  <p>Now in the onResume()-method of my activity I check with getIntent().getStringExtra() for the "STOP" extra, but the intent I retrieved via getIntent() has no extras set :(</p>
  
  <p>I also tried to check to send an broadcast (i have a broadcast receiver working to communicate from the service to the activity)</p>
  
  <pre><code>Intent stopIntent2 = new Intent(MusicPlayerNew.STOP_MEDIAPLAYER);
  PendingIntent stopPendingIntent2 = PendingIntent.getBroadcast(this, 0,
                  stopIntent2, PendingIntent.FLAG_UPDATE_CURRENT);
  mBuilder.addAction(R.drawable.ic_stat_stop, "Stop", stopPendingIntent2); 
  </code></pre>
  
  <p>Now this works if the activity is currently in the foreground. If the activity is in the background the stop button does nothing :(</p>
  
  <p><strong>EDIT:</strong>
  I have the BroadcastReceiver in my Activity as a private class</p>
  
  <pre><code>private class DataUpdateReceiver extends BroadcastReceiver {
          @Override
          public void onReceive(Context context, Intent intent) {
  ..
  }}
  </code></pre>
  
  <p>In the onResume()  register my app for this receiver:</p>
  
  <pre><code>intentFilter = new IntentFilter(STOP_MEDIAPLAYER);
  registerReceiver(dataUpdateReceiver, intentFilter);
  </code></pre>
  
  <p>onPause()</p>
  
  <pre><code>unregisterReceiver(dataUpdateReceiver);
  </code></pre>
  
  <p>Now if I remove the unregistering from the onPause()-method the broadcast is received even if the app/activity is not in the foreground anymore. But is this the right way to do it? I got this register/unregister-stuff from a tutorial on the web i think..</p>