4

I can send windows notification from electron using node-notifier

notifier.notify({
    appName: "myapp",
    title: 'My notification',
    message: 'Hello, there!'
  });

I can run service from electron using node-windows

from my main process

var svc = new Service({
    name: 'MyService',
    description: '',
    script: 'MyService.js',
  });
svc.on('install', function () {
    console.log('Install complete.');
    svc.start();
  });
svc.install();

But when I try to send notification from a service that was created from electron doesn't shows up. Although I checked that code inside the service is ran without any error in the log!

I know this is possible in c# but how do I do that in electron?

Any guide how can I send notification from a service?

Thanks

Anwar Hossain
  • 654
  • 6
  • 21
  • *I can send windows notification from electron using node-notifier* - how did you do that? *I can run service from electron using node-windows* - how did you do that? *But when I try to send notification from a service that was created from electron doesn't shows up.* - how did you do that? The question requires https://stackoverflow.com/help/mcve – Estus Flask Aug 28 '18 at 21:03
  • Are you on windows 10 or windows 8? – Joshua Sep 06 '18 at 09:17
  • Windows 10 @Mike – Anwar Hossain Sep 07 '18 at 07:18

1 Answers1

2

Try to use build in electron notification, document here: https://electronjs.org/docs/tutorial/notifications. In case you tried it but it doesn't work, you must miss this:

On Windows 10, a shortcut to your app with an Application User Model ID must be installed to the Start Menu.

You must set AppID in main process, just put this line in main: app.setAppUserModelId('yourappid')

Hope this helps

Hai Pham
  • 2,188
  • 11
  • 20
  • That seems to be working, I tried wil both electron's notification and node-notifer. No notification shows up after setting appid – Anwar Hossain Sep 07 '18 at 23:12