Wednesday 17 March 2021

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

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?



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

No comments:

Post a Comment