Git Product home page Git Product logo

Comments (7)

mobizt avatar mobizt commented on August 24, 2024 1

I'm apologize for this issue, this is my fault after fixed this issue in the Firebase-ESP32 and Firebase-ESP8266 Client libraries and forgot to update in this Firebase ESP Client library.

Please replace this message/FCM.cpp
https://github.com/mobizt/Firebase-ESP-Client/blob/main/src/message/FCM.cpp

with this gist version of FCM.cpp
https://gist.github.com/mobizt/56a4868478d9d16e7682dbf2f4de9a8d

The next library update will fix with this updated file.

from firebase-esp-client.

mobizt avatar mobizt commented on August 24, 2024 1

The library update v2.1.0 is available with the bugs fixed.

from firebase-esp-client.

mobizt avatar mobizt commented on August 24, 2024

You should update the library to latest version and try again.

from firebase-esp-client.

mobizt avatar mobizt commented on August 24, 2024

After you update the library, you need to follow this example.

msg.payloads.notification.title = "Notification title";
msg.payloads.notification.body = "Notification body";
msg.payloads.notification.icon = "myicon";
msg.payloads.notification.click_action = "OPEN_ACTIVITY_1";

from firebase-esp-client.

Lorenzo-Garcia avatar Lorenzo-Garcia commented on August 24, 2024

Hello, I'm sorry to tell you that the problem has not been resolved. The libraries on the ESP8266 are in their latest version, in the App too. In addition, it should be clarified that from the Node js script I can receive without problems.When analyzing the message with breakpoint I find the following:
category: null
contentAvailable: false
data: Map (3 items)

  • 0: "timestamp" -> "1609815454"
  • 1: "unit" -> "celsius"
  • 2: "temp" -> "28"
    from: "611618541995"
    messageId: "0: 1619149528235791% 0353096bf9fd7ecd"
    messageType: null
    mutableContent: false
    notification: null
    senderId: null
    sentTime: DateTime (2021-04-23 00: 45: 28.232)
    threadId: null

from firebase-esp-client.

Lorenzo-Garcia avatar Lorenzo-Garcia commented on August 24, 2024

I leave my code to be able to analyze it. Although I have only inserted the Token, Wifi credentials and removed comments and console impressions. Muchas gracias por contestar!
#if defined(ESP32)
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#endif
#include <Firebase_ESP_Client.h>

#define WIFI_SSID ""
#define WIFI_PASSWORD "
"

#define FIREBASE_FCM_SERVER_KEY "*"

#define DEVICE_REGISTRATION_ID_TOKEN "*"

FirebaseData fbdo;

unsigned long lastTime = 0;

int count = 0;

void sendMessage();

void setup()
{

Serial.begin(115200);

WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED)
{
    Serial.print(".");
    delay(300);
}

//required for legacy HTTP API
Firebase.FCM.setServerKey(FIREBASE_FCM_SERVER_KEY);

Firebase.reconnectWiFi(true);

#if defined(ESP8266)
//Set the size of WiFi rx/tx buffers in the case where we want to work with large data.
fbdo.setBSSLBufferSize(1024, 1024);
#endif

//Set the size of HTTP response buffers in the case where we want to work with large data.
fbdo.setResponseSize(1024);

sendMessage();

}

void loop()
{

if (millis() - lastTime > 60 * 1000)
{
    lastTime = millis();

    sendMessage();
}

}

void sendMessage()
{

FCM_Legacy_HTTP_Message msg;

msg.targets.to = DEVICE_REGISTRATION_ID_TOKEN;

msg.options.time_to_live = "1000";
msg.options.priority = "high";

msg.payloads.notification.title = "Notification title";
msg.payloads.notification.body = "Notification body";
msg.payloads.notification.icon = "myicon";
msg.payloads.notification.click_action = "OPEN_ACTIVITY_1";

FirebaseJson json;
String payload;

//all data key-values should be string
  json.add("temp", "28");
json.add("unit", "celsius");
json.add("timestamp", "1609815454");
json.toString(payload);
msg.payloads.data = payload.c_str();

if (Firebase.FCM.send(&fbdo, &msg)) //send message to recipient
{

    Serial.println("PASSED");
    Serial.println(Firebase.FCM.payload(&fbdo));
}
else
{
    Serial.println("FAILED");
    Serial.println("REASON: " + fbdo.errorReason());
}

count++;

}

from firebase-esp-client.

mobizt avatar mobizt commented on August 24, 2024

The library works as normally and has been tested before it published.

I also test with Android and Web client again before I post this comment to confirm.

The result is already show the status of your message sending.
Serial.println("REASON: " + fbdo.errorReason());

from firebase-esp-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.