title: Error in remoteMessage.getNotification().getBody()
body: <p>I implemented Firebase Cloud Messaging in my application and while using the Firebase console my application in Android and iOS receives my notifications. But because I wanted to push notification daily I created a cron job to do that in my server side. I notice that every time i trigger my cron my application crashes </p>
  
  <p>In my iOS client it doesn't receive any notification.</p>
  
  <p>In my android client it displays an error:</p>
  
  <p><code>java.lang.String com.google.firebase.messaging.RemoteMessage$Notification.getBody()' on a null object reference</code> </p>
  
  <p>Where it is in my <code>FirebaseMessagingService</code> here is my code</p>
  
  <pre><code>public class MyFirebaseMessagingService  extends FirebaseMessagingService {
  
  @Override
  public void onMessageReceived(RemoteMessage remoteMessage) {
  
      Log.d(TAG, "From: " + remoteMessage.getFrom());
      Log.d(TAG, "Notification Message Body: " + remoteMessage.getNotification().getBody());
  
      sendNotification(remoteMessage.getNotification().getBody());
  } 
  </code></pre>
  
  <p>And in my server-side </p>
  
  <pre><code>function sendNotificationFCM($apiKey, $registrationIDs, $messageText,$id) {
  
  
  $headers = array(
      'Content-Type:application/json',
      'Authorization:key=' . $apiKey
  );
  
  $message = array(
      'registration_ids' =&gt; $registrationIDs,
      'data' =&gt; array(
              "message" =&gt; $messageText,
              "id" =&gt; $id,
      ),
  );
  
  
  $ch = curl_init();
  
  curl_setopt_array($ch, array(
      CURLOPT_URL =&gt; 'https://fcm.googleapis.com/fcm/send',
      CURLOPT_HTTPHEADER =&gt; $headers,
      CURLOPT_POST =&gt; true,
      CURLOPT_RETURNTRANSFER =&gt; true,
      CURLOPT_POSTFIELDS =&gt; json_encode($message)
  ));
  
  $response = curl_exec($ch);
  curl_close($ch);
  
  return $response;
  }
  </code></pre>
  
  <p>I'm wondering why am I having a NPE and how can I solve it? </p>