Custom notification sound of firebase cloud messaging (FCM). Currently only working on Android.
ns plugin add @elgibor-solution/fcm-custom-sound
# app.component.ts
import { customSound, CustomSoundOptions } from '@elgibor-solution/fcm-custom-sound';
const options: CustomSoundOptions[] = [
{ channelId: 'channel_1', audio: 'notif' },
{ channelId: 'channel_2', audio: 'notif2' }
];
customSound(options);
Methods | Return Type | Description |
---|---|---|
customSound(options: CustomSoundOptions[]) |
void |
Plays custom sounds based on the provided configuration options. |
Name | Type | Description |
---|---|---|
channelId |
string |
The channel identifier for the custom sound. |
audio |
string |
The audio file path or resource identifier for the custom sound. Currently only support .wav audio file. Audio file should be placed to folder: App_Resources/Android/src/main/assets/raw |
To enable notification sounds to play in the background, the backend sending FCM must set the channel name or id according to the one specified by the Android application.
The audio file must be in .wav
format and placed in the App_Resources/Android/src/main/assets/raw
folder.
The audio
property in the CustomSoundOptions
interface should only contain the file name without the extension. For example, if the audio file is named notif.wav
, only notif
is required.
Apache License Version 2.0