title: What should I change so that when I click on the notification button, it closes?
body: <p>Last evening the notification was closing, but today I sat down to check and saw that the notification has stopped closing, what should I do?</p>
  <pre><code>private fun sendNotification(){
  
  
         val closeIntent = Intent(this, CloseNotificationReceiver::class.java)
             .putExtra(&quot;ID&quot;, notificationId)
         val closeFlag = if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M)
             PendingIntent.FLAG_IMMUTABLE else 0
         val closePendingIntent = PendingIntent
             .getBroadcast(this, 0, closeIntent, closeFlag)
  
      val builder = NotificationCompat.Builder(this, CHANNEL_ID)
          ///
          .addAction(R.drawable.ic_launcher_background, &quot;400 мл&quot;, closePendingIntent)
          ////
  
  
         with(NotificationManagerCompat.from(this)) {
             notify(notificationId, builder.build())
  </code></pre>
  <hr />
  <pre><code>class CloseNotificationReceiver : BroadcastReceiver() {
  override fun onReceive(context: Context, intent: Intent) {
      val id = intent.getIntExtra(&quot;ID&quot;, 0)
      NotificationManagerCompat.from(context).cancel(id)
  }}
  </code></pre>
  <hr />
  <pre><code>&lt;receiver
          android:name=&quot;.CloseNotificationReceiver&quot;
          android:enabled=&quot;true&quot;
          android:exported=&quot;false&quot; /&gt;
      &lt;meta-data
          android:name=&quot;com.google.firebase.messaging.default_notification_icon&quot;
          android:resource=&quot;@drawable/emblema&quot; /&gt;
  &lt;/application&gt;
  </code></pre>