Firebase Cloud Messaging (FCM)
Send Firebase Cloud Messaging V1 push notifications from Delphi. Service-account JWT signing, OAuth 2.0 token exchange and typed FCM message construction in one component.
Send Firebase Cloud Messaging V1 push notifications from Delphi. Service-account JWT signing, OAuth 2.0 token exchange and typed FCM message construction in one component.
FCM HTTP V1 client — loads your Google service-account JSON, signs an RS256 JWT, exchanges it for an OAuth access token and POSTs the FCM message to fcm.googleapis.com/v1/projects/<id>/messages:send.
TsgcHTTPGoogleCloud_FCM_Client
Windows, macOS, Linux, iOS, Android
Standard / Professional / Enterprise
Load your Firebase service-account JSON, set the project id, then call SendMessage with the FCM payload (token / topic / condition).
uses
sgcHTTP;
var
FCM: TsgcHTTPGoogleCloud_FCM_Client;
begin
FCM := TsgcHTTPGoogleCloud_FCM_Client.Create(nil);
FCM.GoogleCloudOptions.ServiceAccountJSON.LoadFromFile('service-account.json');
FCM.SendMessage(
'fcm-device-token-here',
'Hello from Delphi',
'This is a test FCM push');
end;
// uses: sgcHTTP
TsgcHTTPGoogleCloud_FCM_Client *FCM = new TsgcHTTPGoogleCloud_FCM_Client(this);
FCM->GoogleCloudOptions->ServiceAccountJSON->LoadFromFile("service-account.json");
FCM->SendMessage(
"fcm-device-token-here",
"Hello from Delphi",
"This is a test FCM push");
Targets the FCM HTTP v1 endpoint — the legacy fcm.googleapis.com/fcm/send endpoint was deprecated by Google.
Loads the standard Firebase service-account JSON, signs an RS256 JWT with the contained private key, then exchanges it at oauth2.googleapis.com/token for an access token.
SendMessage overloads accept a registration token, a topic name (/topics/news) or a topic condition expression. SendBroadcast targets a topic for fan-out.
Both the notification object (title/body/image) and the free-form data dictionary are exposed, including platform-specific overrides (Android android, iOS apns, Web webpush).
Access tokens are cached and refreshed only when expired, so high-volume senders don't hammer the OAuth endpoint.
Uses the project's standard HTTP client — pair with proxies, TLS settings and rate limiters as you would any other HTTP request.
OnSendError reports HTTP and FCM-specific errors (unregistered token, invalid argument, quota exceeded) so you can prune dead tokens or back off.
Authoritative sources for the API this component implements.
Enlace directo a la referencia del componente, descarga el proyecto demo listo para ejecutar y la prueba gratuita.
| Online Help — FCM Client Referencia completa de propiedades, métodos y eventos de este componente. | Abrir | |
| Demo Project — Demos\20.HTTP_Protocol\03.Google Proyecto de ejemplo listo para ejecutar. Se incluye en el paquete sgcWebSockets — descarga la prueba gratuita más abajo. | Abrir | |
| Documento técnico (PDF) Características, inicio rápido, ejemplos de código para Delphi y C++ Builder y referencias de fuentes primarias — solo este componente. | Abrir | |
| Manual de usuario (PDF) Manual completo que cubre todos los componentes de la biblioteca. | Abrir |