title: FirebaseMessagingService 11.6.0 HandleIntent
body: <p>The <code>FirebaseMessagingService</code> has the method <code>onMessageReceived()</code> which we should <code>override</code> to handle <code>notifications</code>, but this only works when the app is in <code>Foreground</code>.</p>
  
  <p>To handle <code>notifications</code> even when the app is in background, I used to override the <code>handleIntent</code>, to just call the <code>onMessageReceived()</code>.</p>
  
  <p>In <code>FirebaseMessagingService</code> 11.6.0, the method <code>handleIntent</code> became final, with that said, I can't override it as I was doing.</p>
  
  <p>How should I handle notifications when my app is in background in the 11.6.0?</p>
  
  <pre><code>public class NotificationsListenerService extends FirebaseMessagingService {
      private static final String TAG = "NotificationsListenerService";
  
      @Override
      public void onMessageReceived(RemoteMessage remoteMessage) 
  
          String notifyData = remoteMessage.getData().get("notifData");
  
          if(notifyData.contains("|")){
              String[] itens = notifyData.split("\\|");
              notifyData = itens[0];
          }
  
  
          String notifyType = remoteMessage.getData().get("notifType");
          String title = remoteMessage.getData().get("title");
          String message = remoteMessage.getData().get("body");
  
          if(!isAppInForeground(App.getContext())){
              sendNotification(title, message, notifyData, notifyType);
          }
      }
  
      @Override
      public final void handleIntent(Intent intent) {
          ...
          this.onMessageReceived(builder.build());
          ...
      }
  
      private void sendNotification(String messageTitle, String messageBody, String notifyData, String notifyType) {
          ...
      }
  
  
      //Detect if app is in foreground
      private boolean isAppInForeground(Context context) {
          ...
      }
  }
  </code></pre>