title: Data messages from FCM not enabling onMessagereceived when app is killed
body: <p>As per <code>https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages</code>, I can use data messages which will be 100% received onMessageReceived method and act accordingly. But in my case none of my messages are received when app is killed. Though they are sometimes received when I'm testing on Nexus 5 only. Below is my data payload.</p>
  
  <pre><code>05-16 06:46:01.663 13199-29574/jss.test E/MyFirebaseMsgService: Data Payload: {data={"image":null,"title":"My message"}}
  05-16 06:46:01.667 13199-29574/jss.test E/Providerfalse: true
  05-16 06:46:01.667 13199-29574/jss.test E/MyFirebaseMsgService: Notification JSON {"data":{"image":null,"title":"My message"}}
  </code></pre>
  
  <p>Manifest For FCM as below:</p>
  
  <pre><code> &lt;service
              android:name=".FirebaseMessagingService"
              android:enabled="true"
              android:exported="true"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.google.firebase.MESSAGING_EVENT" /&gt;
              &lt;/intent-filter&gt;
          &lt;/service&gt;
  </code></pre>
  
  <p>Firebasemessaging service:</p>
  
  <pre><code>  @Override
      public void onMessageReceived(RemoteMessage remoteMessage) {
          super.onMessageReceived(remoteMessage);
          if (remoteMessage.getData().size() &gt; 0) {
  
              Log.e(TAG, "Data Payload: " + remoteMessage.getData().toString());
              try {
                  JSONObject json = new JSONObject(remoteMessage.getData().toString());
                  sendPushNotification(json);
              } catch (Exception e) {
                  Log.e(TAG, "Exception: " + e.getMessage());
              }
          }
      }
  
  
      //this method will display the notification
      //We are passing the JSONObject that is received from
      //firebase cloud messaging
      private void sendPushNotification(JSONObject json) {
                     //optionally we can display the json into log
          Log.e(TAG, "Notification JSON " + json.toString());
          try {
              //getting the json data
              JSONObject data = json.getJSONObject("data");
  
              //parsing json data
              String title = data.getString("title");
              String message = data.getString("message");
              String imageUrl = data.getString("image");
  
  //code to call service if message has specific data values.
      }
          catch (Exception e) {
                      e.printStackTrace();    }}
  </code></pre>
  
  <p>Can you guide where I fix to make it working perfectly. </p>