---
title: "Use Firebase Cloud Messaging for Android · Agent Wranglers"
url: https://agentwranglers.se/playbook/stack/product-services/fcm-push
updated: 2026-10-21
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Use Firebase Cloud Messaging for Android and Apple app push

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Product services](https://agentwranglers.se/playbook/stack/product-services.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers). Updated 2026-10-21.

- Level: Recommended
- Chapter: [Product services](https://agentwranglers.se/playbook/stack/product-services)
- Rule: Send push messages to installed Android and Apple apps through Firebase Cloud Messaging with the Firebase Admin SDK.
- Cost: Free service. Google charges nothing to send, but the service is not open source. No open source service can reach these phones, because Android delivers through Google's servers and Apple only through APNs.
- How: The firebase-admin npm package reached 1.0.0 in July 2014, and 14.5.0 shipped on 23 September 2026. It had about 5.9 million weekly npm downloads in October 2026. The Python package reached 1.0.0 in April 2017, and had about 4.0 million weekly downloads. Both are Apache-2.0. One send call reaches Android and Apple clients through the FCM v1 API. Device tokens are your only stored state, so leaving means sending through APNs and the web push standard directly. Keep messages to [Use the current APNs and FCM interfaces](https://agentwranglers.se/playbook/notifications/push-notifications/apns-fcm-current-apis) and [Delete dead subscriptions and tokens at once](https://agentwranglers.se/playbook/notifications/push-notifications/prune-push-subscriptions). Choose something else when you only push to browsers. The [Web Push standard](https://agentwranglers.se/playbook/stack/product-services/web-push-standard) above needs no Google account. Choose APNs directly when you ship only to Apple devices.
- Check: Every send uses the Admin SDK or the FCM v1 endpoint, and the code has no legacy FCM server key. A send to an unregistered token deletes that token in a test.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
import { initializeApp } from 'firebase-admin/app';
import { getMessaging } from 'firebase-admin/messaging';

initializeApp();

export const notifyOrderShipped = (token, orderId) => getMessaging().send({
  token,
  notification: { title: 'Your order has shipped', body: `Order ${orderId} is on its way.` },
});
```

### Python example

```python
import firebase_admin
from firebase_admin import messaging

firebase_admin.initialize_app()

def notify_order_shipped(token: str, order_id: str) -> str:
    return messaging.send(messaging.Message(
        token=token,
        notification=messaging.Notification(title="Your order has shipped", body=f"Order {order_id} is on its way."),
    ))
```

## Sources

- [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging)
- [RFC 8030 Generic Event Delivery Using HTTP Push](https://www.rfc-editor.org/rfc/rfc8030)

## Related rules

- [Use the current APNs and FCM interfaces](https://agentwranglers.se/playbook/notifications/push-notifications/apns-fcm-current-apis) in Notifications
- [Delete dead subscriptions and tokens at once](https://agentwranglers.se/playbook/notifications/push-notifications/prune-push-subscriptions) in Notifications
- [Use the Web Push standard for browser push](https://agentwranglers.se/playbook/stack/product-services/web-push-standard) in Software choices

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/stack/product-services/fcm-push">Agent Wranglers software choices playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Use the Web Push standard for browser push](https://agentwranglers.se/playbook/stack/product-services/web-push-standard)
- Next: [Use Twilio to send text messages](https://agentwranglers.se/playbook/stack/product-services/twilio-sms)
- [Product services](https://agentwranglers.se/playbook/stack/product-services)
