Reputation: 71
My electron app is not displaying desktop notifications on windows 10. Mac and Linux are working fine.
I am using electron-packager to build.
Documentation says "On Windows 10, a shortcut to your app with an Application User Model ID must be installed to the Start Menu." so i call app.setAppUserModelId(myID) in main.js and i put a shortcut to the .exe inside C:\Users\sam\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
Still no notifications. I'm not sure which step I am doing wrong.
Upvotes: 6
Views: 5778
Reputation: 61
I'm using electron-builder and it works like a charm.
Electron multiplatform notifications
I uploaded this code to my GitHub repository. It works on Windows, MacOS and Linux. If you want that notifications work on windows, you need to install the app running 'npm run dist'. It creates a folder called 'dist' where you can find the installer.
This is the important part:
app.on('ready', () => {
if (process.platform === 'win32') {
app.setAppUserModelId("com.ikobit.desktop-notifications");
}
...
});
Upvotes: 6
Reputation: 71
The issue was I was setting the app id in multiple locations. I also needed to install with electron-builder and then it worked.
Upvotes: 0