Nikhil
Nikhil

Reputation: 201

Electron app not showing in notification settings

We have written an electron app. It shows notifications (Win10). Once the app was spamming with a lot of notifications so I switched them off from the notification tile.

As seen in the image

I wanted to enable them back. So I went to notification settings and I could not find my app in the list.

PS: We are using electron Notification module and we are also calling app.setAppUserModelId("OurAppName")

Upvotes: 7

Views: 3279

Answers (2)

setec
setec

Reputation: 16120

Make sure you've a shortcut for your app in the start menu.

https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/hh802762(v=vs.85)

Without a valid shortcut installed in the Start screen or in All Programs, you cannot raise a toast notification from a desktop app.

For electtron-builder there's a setting to force shortcut creation: Electron Builder NSIS Create a shortcut in startup

node-notifer can force-create shortcut too, check basic example code:

//run with Node
const notifier = require('node-notifier');
notifier.notify('Message');

Also, it's important to have appId match one which is in setAppUserModelId. For Electron builder, for windows build, appId is set in

"win": {
  ....
  "appId": "MyApp"
},

Upvotes: 0

GodLess
GodLess

Reputation: 58

This is a semi-known issue where electron applications are simply missing from Windows Notifications Center.

Try changing

app.setAppserModelId("yourAppName");

To

app.on('ready', () => app.setAppUserModelId("Your.AppName"));

I had the same issue recently and this did the trick for me, I found the solution here: https://github.com/Automattic/simplenote-electron/pull/2483

In other iterations of similar issues, there is a workaround to enable notifications again which can be found here: https://github.com/electron/electron/issues/24330#issuecomment-650546142

For Electron you can find the event 'ready' here: https://www.electronjs.org/docs/api/app#event-ready

Upvotes: 3

Related Questions