npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gabpereira21/capacitor-fcm-custom-sound

v1.0.3

Published

Capacitor plugin for FCM with custom notification channel and sound. Zero OutSystems dependencies.

Downloads

382

Readme

@gabpereira21/capacitor-fcm-custom-sound

Plugin de Capacitor para Firebase Cloud Messaging con soporte de canales de notificacion y sonido personalizado.

Instalacion

npm install @gabpereira21/capacitor-fcm-custom-sound
npx cap sync

Configuracion

Android

  1. Coloca google-services.json en android/app/
  2. Para sonido custom: coloca .wav en android/app/src/main/res/raw/

iOS

  1. Coloca GoogleService-Info.plist en ios/App/App/
  2. Para sonido custom: incluye .wav en el bundle de la app (max 30s)

Uso basico

import { FCMCustomSound } from '@gabpereira21/capacitor-fcm-custom-sound';

// 1. Registrar dispositivo (pide permiso + obtiene token)
const { token } = await FCMCustomSound.registerDevice();
console.log('FCM Token:', token);

// 2. Crear canal con sonido custom (Android)
await FCMCustomSound.createChannel({
  channelId: 'my_alerts',
  channelName: 'Alertas',
  channelDescription: 'Canal con sonido personalizado',
  soundFileName: 'custom_sound',  // sin extension! archivo: res/raw/custom_sound.wav
  importance: 4,
  enableVibration: true,
  enableLights: true
});

// 3. Escuchar notificaciones en foreground
FCMCustomSound.addListener('notificationReceived', (notification) => {
  console.log('Foreground notification:', notification.title, notification.body);
});

// 4. Escuchar clicks en notificaciones
FCMCustomSound.addListener('notificationClicked', (notification) => {
  console.log('User tapped notification:', notification);
});

// 5. Escuchar refresh de token
FCMCustomSound.addListener('tokenRefreshed', (data) => {
  console.log('New token:', data.token);
});

Enviar notificacion con sonido custom desde Firebase

{
  "message": {
    "token": "DEVICE_FCM_TOKEN",
    "notification": {
      "title": "Alerta!",
      "body": "Tienes un nuevo mensaje"
    },
    "android": {
      "notification": {
        "channel_id": "my_alerts",
        "sound": "custom_sound"
      }
    },
    "apns": {
      "payload": {
        "aps": {
          "sound": "custom_sound.wav"
        }
      }
    }
  }
}

Cambiar el sonido de un canal

Android no permite cambiar el sonido de un canal existente. Debes:

await FCMCustomSound.deleteChannel({ channelId: 'my_alerts' });
await FCMCustomSound.createChannel({
  channelId: 'my_alerts_v2',
  channelName: 'Alertas',
  soundFileName: 'new_sound'
});

Debug: listar canales

const { channels } = await FCMCustomSound.listChannels();
channels.forEach(ch => {
  console.log(`${ch.channelId}: sound=${ch.soundFileName}, importance=${ch.importance}`);
});

Extensibility Configuration para OutSystems ODC

{
  "plugin": {
    "url": "https://registry.npmjs.org/@gabpereira21/capacitor-fcm-custom-sound/-/capacitor-fcm-custom-sound-1.0.0.tgz"
  },
  "resource": {
    "android": [
      { "src": "www/resources/google-services.json", "target": "app/google-services.json" },
      { "src": "www/resources/custom_sound.wav", "target": "app/src/main/res/raw/custom_sound.wav" }
    ],
    "ios": [
      { "src": "www/resources/GoogleService-Info.plist", "target": "GoogleService-Info.plist" },
      { "src": "www/resources/custom_sound.wav", "target": "custom_sound.wav" }
    ]
  }
}

Notas importantes

  • Android: Una vez creado un canal, su sonido NO puede cambiarse. Usa deleteChannel + createChannel con nuevo ID.
  • iOS: No usa canales. El sonido va en el payload APNS.
  • Formato sonido: .wav, maximo 30 segundos.
  • Android 13+: El plugin pide permiso POST_NOTIFICATIONS automaticamente en registerDevice().

Licencia

MIT