Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 78f18cb

Browse files
Harun.KarahanUrazAkgultan
authored andcommittedJun 5, 2025
fixed sound issue
1 parent 3c68f86 commit 78f18cb

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed
 

‎packages/jsActions/mobile-resources-native/src/notifications/DisplayNotification.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,14 @@ export async function DisplayNotification(
4141
return Promise.reject(new Error("Notifee native module is not available in your app"));
4242
}
4343

44-
const channelId = "mendix-local-notifications";
44+
const channelId = playSound ? "mendix-local-notifications-withsound" : "mendix-local-notifications";
4545
await createNotificationChannelIfNeeded(channelId);
4646

4747
const notification: Notification = {
4848
title: title || undefined,
4949
body,
50-
android: {
51-
channelId
52-
}
50+
android: { channelId, sound: "default" },
51+
ios: playSound ? { sound: "default" } : {}
5352
};
5453

5554
if (subtitle && Platform.OS === "ios") {
@@ -70,7 +69,6 @@ export async function DisplayNotification(
7069
return;
7170
}
7271
const existingChannel = await notifee.getChannel(channelId);
73-
const sound = playSound ? "default" : undefined;
7472
const channel: AndroidChannel = {
7573
id: channelId,
7674
name: "Local Notifications",
@@ -80,10 +78,6 @@ export async function DisplayNotification(
8078
if (existingChannel === null) {
8179
await notifee.createChannel(channel);
8280
}
83-
if (existingChannel?.sound !== sound) {
84-
await notifee.deleteChannel(channelId);
85-
await notifee.createChannel(channel);
86-
}
8781
}
8882

8983
return Promise.resolve();

‎packages/jsActions/mobile-resources-native/src/notifications/ScheduleNotification.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export async function ScheduleNotification(
4242
actionGuid?: string
4343
): Promise<void> {
4444
// BEGIN USER CODE
45-
const channelId = "mendix-local-notifications";
45+
const channelId = playSound ? "mendix-local-notifications-withsound" : "mendix-local-notifications";
4646
await createNotificationChannelIfNeeded(channelId);
4747

4848
if (!body) {
@@ -84,7 +84,6 @@ export async function ScheduleNotification(
8484
return;
8585
}
8686
const existingChannel = await notifee.getChannel(channelId);
87-
const sound = playSound ? "default" : undefined;
8887
const channel: AndroidChannel = {
8988
id: channelId,
9089
name: "Local Notifications",
@@ -94,10 +93,6 @@ export async function ScheduleNotification(
9493
if (existingChannel === null) {
9594
await notifee.createChannel(channel);
9695
}
97-
if (existingChannel?.sound !== sound) {
98-
await notifee.deleteChannel(channelId);
99-
await notifee.createChannel(channel);
100-
}
10196
}
10297

10398
await notifee.createTriggerNotification(notification, trigger);

0 commit comments

Comments
 (0)
Please sign in to comment.