Electron app notifications only showing on development version (non-build)

Viewed 401

I'm trying to trigger a notification in the Electron main process (node). It works fine in development, but in the built .app version, the notification doesn't show? The notification sound is triggered on mac but nothing appears. I've checked the notification center, notification settings in preferences and DND is not on.

Code:

const { Notification } = require('electron');

const notification = new Notification({
    title: 'Oh Dear',
    body:  `Text`,
    icon: path.join(__dirname, 'icons/error.png')
});

notification.on('click', () => {});

notification.show();

Any ideas?

1 Answers

Is your notification icon included when you bundle your app? If yes, check if the path to the icon is correct.

You may also test your notification on other OSes (if your macOS does not want multi-boot setup, try in an VM) if the issue presist across platforms.

Related