title: Firebase Expandable Notification Show image when app is in background
body: <p>I am implementing FCM notifications in Android, but how does notifications differ depending on the app status (background vs. foreground)?</p>
  
  <p><img src="https://i.stack.imgur.com/qabWl.jpg" alt="see notifications image"></p>
  
  <p>I am sending the notification using the FCM API with Postman and this is the notification structure:</p>
  
  <pre><code>{ "notification": {
        "title": "Notification title",
        "body": "Notification message",
        "sound": "default",
        "color": "#53c4bc",
        "click_action": "MY_BOOK",
        "icon": "ic_launcher"
     },
     "data": {
         "main_picture": "URL_OF_THE_IMAGE"  
     },
     "to" : "USER_FCM_TOKEN"
  }
  </code></pre>
  
  <p>The image to render is taken from <code>data.main_picture</code>.</p>
  
  <p>I have implemented my own <code>FirebaseMessagingService</code> which makes the notifications display perfectly in foreground state. The notification code is the next:</p>
  
  <pre><code>NotificationCompat.BigPictureStyle notiStyle = new NotificationCompat.BigPictureStyle();
  notiStyle.setSummaryText(messageBody);
  notiStyle.bigPicture(picture);
  
  Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
  
  NotificationCompat.Builder notificationBuilder = (NotificationCompat.Builder) new NotificationCompat.Builder(this)
              .setSmallIcon(R.drawable.ic_launcher)
              .setLargeIcon(bigIcon)
              .setContentTitle(title)
              .setContentText(messageBody)
              .setAutoCancel(true)
              .setSound(defaultSoundUri)
              .setContentIntent(pendingIntent)
              .setStyle(notiStyle); code here
  
  NotificationManager notificationManager =
              (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
  notificationManager.notify(0, notificationBuilder.build());
  </code></pre>
  
  <p>However, in background, the service is not even executed. In the <code>AndroidManifest.xml</code>, Firebase services are declared as follow:</p>
  
  <pre><code>&lt;service
      android:name=".MyFirebaseMessagingService"&gt;
    &lt;intent-filter&gt;
      &lt;action android:name="com.google.firebase.MESSAGING_EVENT"/&gt;
    &lt;/intent-filter&gt;
  &lt;/service&gt;
  
  &lt;service
      android:name=".MyFirebaseInstanceIDService"&gt;
    &lt;intent-filter&gt;
      &lt;action android:name="com.google.firebase.INSTANCE_ID_EVENT"/&gt;
    &lt;/intent-filter&gt;
  &lt;/service&gt;
  </code></pre>
  
  <p>My problem is not the <code>LargeIcon</code> or <code>SmallIcon</code> but displaying the big picture.</p>
  
  <p>Thanks for your support.</p>