Electron with node-notifier display windows 10 notification

后端 未结 5 885
灰色年华
灰色年华 2021-01-03 05:56

I\'m trying to make a simple app that should display notification when button is clicked. The problem is that the notification does not show, but console.logs are showing. S

5条回答
  •  孤街浪徒
    2021-01-03 06:14

    I've also tried many things, but sometimes it works or not.

    At last, I've found a way. This works well for not only "npm run dev", but also package built.

    • use Notification at renderer process.
    • register app id at package.json

      "build": { "appId": "my app id", ...

    • call app.setAppUserModelId("my app id") at main process (https://electronjs.org/docs/api/app#appsetappusermodelidid-windows)

    Here app id can be any type of string.

提交回复
热议问题