0

I'm developing an app with Expo and facing an issue with push notifications where the custom sound only plays when the app is in the foreground. When the app is backgrounded or closed, the notifications default to the system sound instead of the custom sound I've specified also it uses miscellaneous channelId. I can't understand why it's different in the background than in the foreground , the version im testing is an apk production build. I'm using Expo's managed workflow and sending notifications through their backend (expo-server-sdk). Here's how I configure the notification channel on the frontend:

await Notifications.setNotificationChannelAsync("ltsChannel", {
  name: "ltsChannel",
  sound: "sound.wav", // Custom sound file
  importance: Notifications.AndroidImportance.MAX,
  audioAttributes: {
    usage: Notifications.AndroidAudioUsage.ALARM,
    contentType: Notifications.AndroidAudioContentType.SONIFICATION,
  },
});

And this is how I send notifications from the backend:

const messages = [];
messages.push({
  to: pushToken,
  title: 'Test Title',
  body: 'Test Body',
  channelId: "ltsChannel",
});

any help would be appreciated.

1 Answer 1

0

Try to verify your plugins array in app.json file

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.