title: BroadcastReceiver not firing on notification action click
body: <p>I am trying to create a simple notification with a button (action) defined to it. I have managed to display it properly and create a PendingIntent for my action. I have also created a BroadcastReceiver which is supposed to be called when my action is clicked. But it's onReceive() method does not get called. I have no idea why. I also registered BroadcastReceiver in AndroidManifest.xml</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      Button notify = (Button) findViewById(R.id.notify);
  
      notify.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
  
              Intent dismissIntent = new Intent("action1");
              dismissIntent.setAction("action1");
              PendingIntent action1intent = PendingIntent.getBroadcast(MainActivity.this, (int) System.currentTimeMillis(), dismissIntent, PendingIntent.FLAG_CANCEL_CURRENT);
  
              NotificationCompat.Builder mBuilder =
                      new NotificationCompat.Builder(MainActivity.this)
                              .setSmallIcon(R.drawable.ic_menu)
                              .setContentTitle("My notification")
                              .setContentText("Hello World!")
                              .addAction(R.drawable.ic_menu, "action 1", action1intent);
  
              Intent resultIntent = new Intent(MainActivity.this, MainActivity.class);
              TaskStackBuilder stackBuilder = TaskStackBuilder.create(MainActivity.this);
              stackBuilder.addParentStack(MainActivity.class);
              stackBuilder.addNextIntent(resultIntent);
  
              PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
  
              mBuilder.setContentIntent(resultPendingIntent);
              NotificationManager mNotificationManager =
                      (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  
              mNotificationManager.notify(0, mBuilder.build());
          }
      });
  
  }
  
  public class Receiver extends BroadcastReceiver {
  
      @Override
      public void onReceive(Context context, Intent intent) {
  
          Log.d("log", "Receiving somthn");
  
          String whichAction = intent.getAction();
  
          if (whichAction.equals("action1")) {
              MainActivity.makeToast("This is action 1", context);
          }
      }
  }
  
  
  public static void makeToast(String string, Context context) {
      Toast.makeText(context, string, Toast.LENGTH_SHORT).show();
  }
  }
  </code></pre>
  
  <p>AndroidManifest.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.example.orglce.notification"&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
  
      &lt;receiver android:name=".MainActivity$Receiver"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.example.orglce.notification.BROADCAST" /&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  
      &lt;activity android:name=".MainActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN" /&gt;
              &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>