notification sound on iOS

Thanks for EAS GA.

Based on Notifications - Expo Documentation doc, I’ve implemented custom sound for (local) notifications. After building, it works (sound and vibration) nicely on Android. However, in iOS, neither it sounds nor vibrates.

Any lead on how to debug this issue?

Here is what else I know:

  • iOS: 14.3
  • I hear the default notification sounds on iOS Simulator (but not the custom sound)
  • Both vibration and sound works on android

Thanks in advance

Hey @rajuru, can you share what type of project your using (Managed/Bare) as well as what version of expo-notifications you are running? One possible thing to try is manually implementing the custom sound and testing locally (see the dropdown under this section of the docs)

Cheers,
Adam

@adamjnav Thanks for the response.

Managed workflow
expo-notifications version is 0.13.3

I’m actually doing that. Because scheduled notification testing will slow me down, I’ve added a button that will trigger a notification on click.

const NotificationTest = () => {
  const settings = useSelector((state) => state.settings);
  const notificationSound = getNotificationSoundFilename(settings[REMINDER_AUDIO_SETTING_NAME]);
  const handleNotification = async () => {
    console.log('notificationSound', notificationSound);

    const testChannel = 'test-channel';
    const channel = await Notifications.setNotificationChannelAsync(testChannel, {
      name: 'Test Channel',
      importance: Notifications.AndroidImportance.MAX,
      vibrationPattern: [0, 250, 250, 250],
      lightColor: '#FF231F7C',
      sound: notificationSound,
    });

    console.log('channel', channel);

    const schedule = await Notifications.scheduleNotificationAsync({
      content: {
        title: 'Test Notification',
        body: 'This is a test notification',
        vibrate: [0, 250, 250, 250],
        sound: notificationSound,
      },
      trigger: {
        seconds: 1,
        channelId: channel?.id,
      },
    });

    console.log('schedule', schedule);
  };

  return (
    <Button>
      <Text onPress={handleNotification}>Test</Text>
    </Button>
  );
};

I’ve notification handler setting in another place but it’s in effect.

Only thing I noticed is that channelId. As it’s irrelevant in iOS, should I remove that prop when it’s iOS?

One possible thing to try is manually implementing the custom sound and testing locally (see the dropdown under this section of the docs)

I believe it doesn’t apply in my case as it is Managed workflow!

@adamjnav any thoughts?