Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

play the notification sound simultaneously on android and bluetooth device #2408

@jasimvk

Description

@jasimvk

I want to play the notification sound simultaneously on android phone and bluetooth device

my code is below

messaging().setBackgroundMessageHandler(async (remoteMessage) => {
const { android } = remoteMessage;
const { body, title, android_channel_id } = remoteMessage?.data;
const notificationOptions = {
message: body,
title,
vibrate: true,
importance: Importance.HIGH,
vibrationPattern: [400, 400],
playSound: true,
};
let channels = {
newservice: 'notnew.mp3',
};
if (android?.channelId === "cnclservice" || android_channel_id === "cnclservice") {
channels = {
cnclservice: 'notcncl.mp3'
}

} else if (android?.channelId === "notify" || android_channel_id === "notify") {
channels = {
notify: 'notalert.mp3',
}
}
Object.entries(channels).forEach(([channelId, soundName]) => {
const options = {
...notificationOptions,
soundName,
channelId,
};
PushNotification.localNotification(options);
});
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions