Skip to main content
Back to plugins
@capgo/capacitor-firebase-messaging
Tutorial
by github.com/Cap-go

Firebase Messaging

Capacitor plugin for Firebase Cloud Messaging (FCM)

Guide

Tutorial on Firebase Messaging

Using @capgo/capacitor-firebase-messaging

Capacitor plugin for Firebase Cloud Messaging (FCM).

Install

bun add @capgo/capacitor-firebase-messaging
bunx cap sync

What This Plugin Exposes

  • checkPermissions - Check permission to receive push notifications.
  • requestPermissions - Request permission to receive push notifications.
  • isSupported - Checks if all required APIs exist.
  • getToken - Register the app to receive push notifications. Returns a FCM token that can be used to send push messages to that Messaging instance.

Example Usage

checkPermissions

Check permission to receive push notifications.

import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';

await FirebaseMessaging.checkPermissions();

requestPermissions

Request permission to receive push notifications.

import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';

await FirebaseMessaging.requestPermissions();

isSupported

Checks if all required APIs exist.

import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';

await FirebaseMessaging.isSupported();

getToken

Register the app to receive push notifications. Returns a FCM token that can be used to send push messages to that Messaging instance.

import { FirebaseMessaging } from '@capgo/capacitor-firebase-messaging';

await FirebaseMessaging.getToken();

Full Reference

Keep going from Using @capgo/capacitor-firebase-messaging

If you are using Using @capgo/capacitor-firebase-messaging to plan native plugin work, connect it with Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins, Ionic Enterprise Plugin Alternatives for the product workflow in Ionic Enterprise Plugin Alternatives, and Capgo Native Builds for the product workflow in Capgo Native Builds.