title: Android 12 Pending Intent
body: <p><strong>Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.     Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable</strong></p>
  <p>I can't update the pending intent flag in android studio project coding</p>
  <p>This is a place in AlarmPingSender.java where the error occurred</p>
  <pre><code>  public void start()        
     {       
     String action = MqttServiceConstants.PING_SENDER
              + comms.getClient().getClientId();
      Log.d(TAG, &quot;Register alarmreceiver to MqttService&quot;+ action);
      service.registerReceiver(alarmReceiver, new IntentFilter(action));
  
      pendingIntent = PendingIntent.getBroadcast(service, 0, new Intent(
              action), PendingIntent.FLAG_UPDATE_CURRENT);
  
      schedule(comms.getKeepAlive());
      hasStarted = true;
  }
  </code></pre>
  <p><em>Help me to fix the issue</em> <strong><a href="https://i.stack.imgur.com/9qlGE.jpg" rel="nofollow noreferrer">ERROR IN ANDROID STUDIO IMAGE</a></strong></p>