title: Toast not showing in onMessageReceived of FireBase Cloud Messaging Service
body: <p>I have used below code to make Log,Toast and send broadcast to service from onMessageReceived.</p>
  
  <p>I am able to see the data send using Firebase Console in the Log. But Toast is not showing and Broadcast is also not send.</p>
  
  <p>Code below:</p>
  
  <pre><code>class MyFirebaseMessagingService extends FirebaseMessagingService {
  
      private static final String TAG = "MyFirebaseMsgService";
  
      @Override
      public void onMessageReceived(RemoteMessage remoteMessage) {
  
          Log.d(TAG, "From: " + remoteMessage.getFrom());
          Toast.makeText(getApplicationContext(),"From: " + remoteMessage.getFrom(),Toast.LENGTH_SHORT).show();
  
          if (remoteMessage.getData().size() &gt; 0) {
              Log.d(TAG, "Message data payload: " + remoteMessage.getData());
  
          }
  
          // Check if message contains a notification payload.
          if (remoteMessage.getNotification() != null) {
              Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
              Toast.makeText(getApplicationContext(),"Toast shown",Toast.LENGTH_LONG).show();
              Intent i = new Intent();
              i.setAction("firebase.message.combinedthings");
              sendBroadcast(i);
          }
      }
  }
  </code></pre>