Firebase upstream messages
<p>When sending upstream message most of the times the message does not get to my server, and even when the message received to the server the <code>onMessageSent(String msgId)</code> function isn't called (the <code>onMessageReceived(RemoteMessage fcmMessage)</code> work very well).</p>

<p>Why the function isn't called and why do I need to send 10 upstream messages to get response from the firebase cloud messaging to my server?</p>

<pre><code>new AsyncTask&lt;Void, Void, String&gt;() {
        @Override
        protected String doInBackground(Void... params) {
            String sendTo = SENDER_ID + "@gcm.googleapis.com";
            RemoteMessage.Builder data = new RemoteMessage.Builder(sendTo);
            data.addData("Hello", "World");

            try {
                for (int i = 0; i &lt; 10; i++) {
                    Thread.sleep(1000);
                    String messageID = getRandomString();
                    data.setMessageId(messageID);
                    Logger.d(TAG, "messageID: " + messageID);
                    FirebaseMessaging.getInstance().send(data.build());

                }

            } catch (Exception e) {
                Logger.e(TAG, "Error sending upstream message: " + e.getMessage());
                return "Error sending upstream message:" + e.getMessage();
            }
            return null;
        }

        @Override
        protected void onPostExecute(String result) {
            if (result != null) {
                Logger.e(TAG, "send message failed: " + result);
            }
        }

    }.execute(null, null, null);

}
</code></pre>