Electron: Notification API do not work with Windows 10 16299.19 (fall creators update)

Created on 20 Oct 2017  ·  122Comments  ·  Source: electron/electron

  • Electron version: 1.7.8
  • Operating system: Windows 10 16299.19 - latest update

Expected behavior

Create a desktop notifications.

Actual behavior

No notification.

How to reproduce

Try with yours https://github.com/electron/electron-api-demos

blockeneed-info ❌ bug componennotifications platforwindows

Most helpful comment

I think I found a fix! Calling app.setAppUserModelId(<my app id>) suddenly fixes my notifications.

https://electronjs.org/docs/api/app#appsetappusermodelidid-windows

Can anyone else confirm that this fixes the issue? If this works for everyone, the documentation seriously needs to be updated.

All 122 comments

I am also able to reproduce this with the following setup:

  • Electron version: 1.8.1
  • Windows 10 16299.19
  • Electron API demo application - neither of the _Basic notification_ or _Notification with image_ appears on the desktop or notification center.

Looking at the build changes they have poked around in notifications: https://changewindows.org/build/16299/pc

Other applications has successfully shown notifications in Windows 10 16299.19, both Windows Defender and a third party app.

For the record I've been on the fast insiders track all year and have never had this problem, I'm currently on 17017 and double checked, notifications still work perfectly fine.

I'd suggest y'all got a broke build in 16299, when you update out of that version I wouldn't be surprised if this starts working for you again.

First of all, :wave: Gregor! Lange nicht mehr gesehen!

Secondly, the notification API in Windows 10 remained fundamentally the same, so this isn't gonna be easy. Action Center is pretty unreliable though - and apparently, as I learned from the notification team a few days ago, things can fall apart all the time. I can also confirm the bug on 16299.19, but I'd like to make double-sure that this isn't on Windows.

I'll take a look at this.

As a short-term solution, electron-windows-notifications still works fine.

I can reproduce this, neither of my apps show notifications in Windows 10 17025.

Same here.

  • Win 10 Pro Version 1703 (Build 15063.674) notifications work fine by using window.Notification and electron-windows-notifications
  • Win 10 Enterprise Evalution Version 1709 (Build 16299.9) neither window.Notification nor electron-windows-notifications show notifications.

The second build is the official IE Testing VM already running the Fall Creators Update.

@felixrieseberg Is there something we can do to support you in any way?

Same, my app broke as well with Fall Creators update :(

Macrium Reflect team says the update has restricted the number of apps that can register for notifications (link below). Not sure if this is related but I can confirm that in addition to my Electron app being able to send notification on a pre-Fall Creators Update computer and not a post fall update computer, my app also no longer shows in the "Get notifications from these senders list" after updating whereas it did before.

https://knowledgebase.macrium.com/display/KNOW7/Windows+10+Notifications+-+1709+Fall+Creators+Update

Same problem here. Upgraded to the Fall Creators Update and no more notifications.

I have the same issue.
Notifications can't work on Windows 10 16299.19, but works fine on Windows 10 15XXX.
Electron version is 1.7.9 and 1.7.6
So I use showMessageBox instead of Notifications

Can anyone confirm that switching to electron-windows-notifications fixes the issue?

@levinunnink at least not for me. I tried it directly with the nodeRT as well but without success (electron-windows-notification is built on nodeRT)

So right now there is no known way to get notifications working on Electron + Windows 10 16XXX? Seems like a major problem. It's certainly breaking my app big time. Is anyone working on this?

As a not very satisfying workaround, I'm using a modified version of electron-toaster for 16XXX+ computers right now which creates a new browser window that looks, acts, and appears/disappears like a notification. But it would be really good to get access to native notifications back.

I think I found a fix! Calling app.setAppUserModelId(<my app id>) suddenly fixes my notifications.

https://electronjs.org/docs/api/app#appsetappusermodelidid-windows

Can anyone else confirm that this fixes the issue? If this works for everyone, the documentation seriously needs to be updated.

@levinunnink setAppUserModelId Fixes the issue for me too, Thx !

Same issue here.

Quick question: Which appUserModelId are you using to fix this? Electron already calls app.setAppUserModelId(com.squirrel.${packageName}.${exeName}), but only if your app was pacakged as a Squirrel app.

@felixrieseberg We ship our app using electron-packager, I don't think we use squirrel. The app id I used was the one in package.json build.appId.

That did it! Using app.setAppUserModelId and specifying the same id used in package.json got native notifications back up and running -- and the app also now shows up in the Windows "Notifications & actions" settings page. Thank you so much!

Somewhat related: #11331

Thanks a lot! It works.

I cannot solve the problem 👎

Details:
Renderer code

const notification = {
        title: 'Basic Notification',
        body: 'Short message part'
}

const myNotification = new window.Notification(notification.title, notification)
myNotification.onclick = () => {
         console.log('Notification clicked')
 }

Main code:

...
app.setAppUserModelId("com.dev.name")
app.on('ready', () => {
...

Software:
Windows 10 Pro 1709 (16299.98 64bits)
Electron 1.7.9

Envs:
Windows 10 Pro 1709 (16299.98 64bits)
Electron 1.7.9

My app's notification doesn't appear too.
But sound effect is played as usual.
Since yesterday(Windows Update applied 1709 Fall Creators Update to my PC).
I tried adding statement app.setAppUserModelId(${package.json build.appId}); to main process or renderer process or both.
But it doesn't affect.

Uses of notification is native and not programmatic by me because my electron app is simple browser so instantiater of Notification is web content in webview.

@samuelcarreira , @quietnumeric

To start up the notifications you will need to create an installer and install the app. At least for me that was the only way they started working (after the actual install) . After that my app was showing up in notification settings on windows 10 as well.

To create an installer I used electron-builder. And as in their example I set appId in package.json and setAppUserModelId in the main process.

https://github.com/electron-userland/electron-builder#quick-setup-guide

app.setAppUserModelId(<my app id>) did not work for me on Windows build 16299.125. Using electron-packager as well. Subscribing.

@ClaudiaStefan, @EternallLight
Thanks to you, I saw notification again by electron-builder with simple config JSON.
I just tried electron-packager for avoiding installer when posted.

By the way, once Application-User-Model-ID was entried to Windows registry("Notifications & actions"), it seems to appear notification when sent from any app has same Application-User-Model-ID.
After that I divided myApp into myApp-notification-register(by electron-builder) and myApp(by electron-packager).
Then portability remained at myApp and I saved time for continual build.
The time required of electron-builder running is too long for me. :D

I used electron builder to build my app (output to unpacked dir) and create an installer with inno setup (I used the same appID on app an inno script).
The notifications continue to not show up...

@samuelcarreira You installed the app and you still didn't see the notifications ?
I could only get it to work after I installed my app.

@ClaudiaStefan yes I installed the app on my system. I didn't have any problem on macOS or Linux, only on the newest Windows 10.
Also on the settings -> notifications page, I didn't have any entry for my app.
As this is not a crucial feature, I think that I will wait for a proper fix...

@samuelcarreira What appUserModelID are you setting?

@samuelcarreira
Did you define property 'appId' in config for electron-builder top level?
I noticed yesterday, to make registration succeed, that property must be either of the following only.

  • Not define.
  • Same id to package.json-build.appId and appUserModelId.

If you define property different from appUserModelId, it will fail.

And I tried to create installer only by NSIS.

@MarshallOfSound, @quietnumeric
Main process code:

Package.json (I use two package.json structure)

Even if the method above works, does it work only for apps that use electron-builder for making an installer? What about those who use electron-packager? We use electron-packager and them wrap it with Inno Setup. Should I somehow specify the Application User Model ID in the installer?

@EternallLight I used the same appID on the inno setup script and I didn’t have any success with the notifications
I didn’t try to create an NSIS installer with the electron packager because I never used the NSIS and I am happy with the innosetup results

@samuelcarreira, yep, the same results here. I also tried to use a WindowsBalloon from node-notifier, and it worked, but for some reason, it also displays a help strings within a "Balloon" (it looks like a notification in Windows 10), which does not seem good to me, either. Guess we've got nothing else but wait for a proper fix.

notification not working on win10 build 14393.2608 32bit
ps: generate notification from the HTML5 Notification API

Still not working

(Windows 10 Pro 1709 (16299.248 64bits) + Electron 1.8.3)

@NicolasConstant what steps have you taken?
Notifications on updated Win10 now follow the same rules as Win8/8.1 (perhaps the docs needs to be updated?)

On Windows 8.1 and Windows 8, a shortcut to your app, with an Application User Model ID, must be installed to the Start screen. Note, however, that it does not need to be pinned to the Start screen.

So you need to define your Application User Model ID, set it inside your app with app.setAppUserModelId and have a shortcut in your start screen with AppUserModelId set to the same thing.

If you have the notifications working on Win8/8.1 and not on Win10, it's likely a different issue and a different solution.

@ToreJuloe
I tried the https://github.com/electron/electron-api-demos (maybe it should be updated?)

As I'm pretty new in Electron, I tried to see where the app.setAppUserModelId should be called, and I found this gist (with uncommenting the setAppUserModelId(); call) but it didn't do the trick.

According to your response, I need also to deploy some shortcuts in the start menu to make it work? That sounds a bit crazy to me, where should I give such AppUserModelId then? Do that mean that notifications can only work when launched on a released build called by some arguments via a shortcut?
I'm a Windows developer but I have never seen such behavior before...

@NicolasConstant

Most likely that API demo will not work on Win10 1709 or Win8/8.1. I do not have another example on hand that will.

  • _Where should he app.setAppUserModelId should be called?_
    As early as possible is my guess. If you have a main.js or something similar, that would be the place.

  • _Do I also need to deploy some shortcuts in the start menu to make it work?_
    Yes. Same as for Win8/8.1 as stated in the docs. My first feeble attempt at this, was by copying the method from here (steps 1-4).
    I don't really touch the installer logic and I'm sure there are many different ways of doing it, but in the project I'm working on, the AppUserModelId is set in a .wxs-file inside a <Shortcut>-tag with an element like this:

<ShortcutProperty Key="System.AppUserModel.ID" Value="AppUserModelId goes here" />

The good thing is, that once you have a shortcut in the start screen, it doesn't matter where you launch your app from, as long as it identifies itself with the proper AppUserModelId.

That sounds a bit crazy to me

It certainly sounds crazy to me too, but here we are :)

@ToreJuloe Thank you so much! With the shortcut in the Windows menu, it finally works. :)
I also found some C# code sample to generate the shortcut+AppUserModelId and test it easily.

Thanks @NicolasConstant for finding that code sample! That app easily registered my electron app for notifications.

node-notifier seems to be a good alternative.

I was able to get the notifications to work in our app, but they don't stick around in the action center/notification bar. So I see it come up as a popup in the bottom right but then can't see it in the action center. Anyone noticing the same? Is this an electron issue too?

@tzarebczan I noticed the same thing, we would really appreciate if notifications can be shown in the action center.

I have the same problem on Notification API and forcing "setAppUserModelId " didn't solve it.

The odd thing is that the same Electron App shows the notification only on specific windows 10 desktops(build: 14393.953); the ones updated to latest Windows 10 update cannot show it (build: 16299.309).

@tzarebczan
I was able to get the notifications to work in our app, but they don't stick around in the action center/notification bar. So I see it come up as a popup in the bottom right but then can't see it in the action center. Anyone noticing the same? Is this an electron issue too?

I think this may be related with https://github.com/electron/electron/issues/3916

Thanks to the clues in this thread, I got notifications working again in Keybase, though without the action center history: https://github.com/electron/electron/issues/10864
@ToreJuloe I read elsewhere that using Keybase.Keybase.GUI by name in a WIX installer causes errors on Windows 7, but the GUID method works for me and is supposed to be safe on Win7

I get it working again by setting Notification on import, setting model ID and default protocol:
```js
import { app, Notification } from "electron"

app.setAppUserModelId("com.xxxx.xxxx");
app.setAsDefaultProtocolClient('xxxxx');

@marceloavf no shortcut properties required?

Sorry @zanderz, What do you mean?
I was using this electron-builder method to do the job, after adding those options it started notifying.

Hello, has anyone been able to get notifications working again without the use of app.setAppUserModelId? As we are in early development we don't have a start menu shortcut and I am not entirely clear on how to get the UserModelId. We're launching via vs code debugging.
I've tried 1.8.4 and the latest 2.0.0 beta from the main proccess and render.
On windows 10 Enterprise version 1709 build 16299.309

@Zaldos You can set it to any unique string, it just has to match in the shortcut and the call to set it. Making a shortcut is easy, you just have to tweak the registry to present the appUserModelId in the explorer's properties dialog so you can set it there: https://winaero.com/blog/how-to-show-more-details-for-shortcuts-in-windows-8-1-windows-8-and-windows-7/
@marceloavf I meant whether you got notifications without making such a shortcut but maybe the electron builder or your installer packaging does that for you?

@zanderz What would it take to be able to make it work if I'm using "npm start" which runs "electron -r babel-register ."

Finally, I get notifications to work on my app!

OS:
Windows 10 Pro v1709, compilation: 16299.371

Renderer Code (note that the notifications didn't work from main process):

let myNotification = new Notification('Title', {
    body: 'Lorem Ipsum Dolor Sit Amet'
  })

  myNotification.onclick = () => {
    console.log('Notification clicked')
  }

https://electronjs.org/docs/tutorial/notifications

Main process code:

app.setAppUserModelId("com.samuelcarreira.xxx");
app.setAsDefaultProtocolClient('xxx');

Now the important part. As pointed by other users, you need to install your app and create icons with AppUserModelID reference.
Inno Setup Script (.iss file)

[Icons]
Name: {commonprograms}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; AppUserModelID: "com.samuelcarreira.xxx"

When the app was installed you can can also get notifications to work even from the IDE (run app as dev)!

Thank you all for your tips :-)

@samuelcarreira, tried and tested. Once installed, even the development had notifications. Used Inno Setup and Inno Script Studio to build the installer on Windows 10 16299.371.

@samuelcarreira I can confirm your "tutorial" solved my problem too! (I wasn't using the "setAsDefaultProtocolClient" method)

Thanks for sharing it!

I get it working:

// after install python 2.7 and VS2017
// Copy C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.xxxx\Windows.winmd to  C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd
npm install --save electron-windows-notifications

Main code:

import { app } from 'electron'
app.setAppUserModelId("com.xxx.xxxx");

Just okey. You can try:

let myNotification = new Notification('title', {
    body: 'content'
  })

I get it working after I use electron-builder to pack the app and install it.
But if I use electron-packager and grunt-electron-installer to pack with the same code, it doesn't show the notification.

I'm using electron-windows-installer, which uses Squirrel.Windows to build an installer. I created the shortcut with Squirrel's Update.exe --createShortcut command, which apparently creates a shortcut with an Application Model User Id of com.squirrel.{YOUR NUGET PACKAGE ID}.{YOUR EXE NAME MINUS DOT EXE} ( i.e. com.squirrel.myapp.MyApp). I had to call app.setAppUserModelId with the same id (i.e. app.setAppUserModelId('com.squirrel.myapp.MyApp')) in order to get notifications working again after install.

I haven't found a way to enable notifications when running electron locally (without packaging/installing).

You can simply set app.setAppUserModelId(process.execPath) so it will work with a good old drag n drop shortcut. Still need the shortcut though. But no need to mess with the shortcut. Windows set the app location as App user model ID in default so win32 apps could support notifications.

Note: This method will work for packaged apps right off the bat but If you are on dev mode you can simply create a shortcut to the electron executable inside your project's node_modules > electron > dist directory.

@m4heshd, I can confirm app.setAppUserModelId(process.execPath) that it shows notification when packaged but I can't seem to get it working on development mode. Can you comment a screenshot of what you did to make notifications work with your procedure?

@roelpaulo when you execute an electron app on development it executes the electron.exe. So your process.execPath will point to that. That means you need to create a shortcut to electron.exe. Path would be <YOUR_PROJECT_DIR>\node_modules\electron\dist\electron.exe.

As an alternative you can use windows-shortcuts module to create a shortcut.

var ws = require('windows-shortcuts');
ws.create("%APPDATA%/Microsoft/Windows/Start Menu/Programs/Electron.lnk", process.execPath);

@m4heshd, Thanks, it's working now on development mode. It's really strange that it wouldn't work on mine when I did the drag-and-drop shortcut of electron dist on the start menu. Cheers bro 👍

I'm a new of electrion. I haven't solved this issue yet...

  • Electron: 1.7.11
  • Windows: 10.0.16299.431
  • Builder: electron-builder
  • Build target: squirrel

I use electron-builder to build a windows app installer.
I read this issue's discussion and do below, but notification doesn't work.

  1. set app.setAppUserModelId(${package.json build.appId}); to main.js
  2. set build.appId to package.json
  3. build an app by electron-builder
  4. check if notification is enabled

However, if I use NSIS by Build target instead of squirrel , notification works fine.
Does anyone know how to fix this?

@samuelcarreira it's worked for me, thx for your share 💯

my env as follow:

  • electron: 1.8.4
  • win10: 1803(17134.48)

@Hubu this stopped working for me on my Windows 10 1803.
It was working until a couple hours ago and I didn't change a damn thing until now!

Is there some kind of behaviour of Windows 10 we should know about it?

Guys I solved this one using 1024x1024 .png images for your notifications on Windows.

No need for either app.setAppUserModelId or app.setAsDefaultProtocolClient, no matter Win7 or Win10.

And I'd like add: FOR F**K SAKE.

@develar if you could double check this and confirm it I'd suggest adding it to docs!

@damianobarbati nope. It doesn't work. Still the easiest way is app.setAppUserModelId(process.execPath);.

Windows - 17134
Electron - 2.0.0 and 1.8.x

Guys I found it works with win10 1703(15063), but not with win10 1803(17134).
Maybe electron needs to update to fix with the new Windows version.

@Cheney925 i don't think there's a fix because it's simply a requirement set by Windows. No App ID and no shortcut? no notifications.

@m4heshd I did the same with you.
app.setAppUserModelId(process.execPath)
Same Windows version and Electron version.
And I'm sure there is a shortcut.
SO WHY?

@Cheney925 is your app in development or production(packaged)? Also how did you create the shortcut?

@m4heshd Sorry, it's a code error. Solved now, Thanks!

Is it documented somewhere what changes are required to make notifications work?

@Anrock https://electronjs.org/docs/tutorial/notifications

If you want to try other options just read this thread from bottom to the top.

@levinunnink Thanks. But after setting app.setAppUserModelId(<my app id>) Notification doesn't stay in Action centre

Has anyone noticed that Electron app notifications block other windows notifications? I've seen cases when I close my electron app, I see other windows notifications pouring in.

@felixrieseberg Nós enviamos nosso aplicativo usando electron-packager, eu não acho que nós usamos o esquilo. O ID do aplicativo que usei era o que estava em package.json build.appId.

nice... thks.....

windows 10

  1. add node_moduleselectrondistelectron.exe to Start Menu
  2. main.js add app.setAppUserModelId(process.execPath)

@GregorBiswanger
Thank you for taking the time to report this issue and helping to make Electron better.

The version of Electron you reported this on has been superseded by newer releases.

If you're still experiencing this issue in Electron v2.0.x or later, please add a comment specifying the version you're testing with and any other new information that a maintainer trying to reproduce the issue should know.

I'm setting the blocked/need-info label for the above reasons.

Thanks in advance! Your help is appreciated.

@sofianguy Electron 4.0.1 not working

@sofianguy I am experiencing the notifications not working too.

  1. I did a fresh install of electron with npm i -g electron@latest
  2. I then added a shortcut to electron.exe to my start menu as instructed from here
  3. I restarted my pc which is running:

    • Windows 10 Pro

    • Version 1803

    • OS Build 17134.523

  4. I then cloned the electron-api-demos repository and install dependencies with npm i
  5. Then I attempted to run both _Notifications with and without custom image_ demos but neither produced any native notifications
    image

Notifications do not work for me using the API Demos App on Windows 10 Enterprise, Version 1803 (OS Build 17134.523)

  • Electron 4.0.1
  • Node 8.12.0

Notifications do not work for me using the API Demos App on Windows 10 Enterprise, Version 1803 (OS Build 17134.523)

  • Electron 4.0.1
  • Node 8.12.0

It is not working with nodejs 10.15.1 also.

Please remember that you would need to package the app for the fix with setting app id to work.

And also running the app using a proper shortcut.

Guys, please read-back, this one already had some work arounds for notification that is working both on development and a packaged app on whatever version of windows you have. You must have the proper app guid and the shortcut at the same time.

Correct. And it's also noted in readme https://electronjs.org/docs/tutorial/notifications#windows. So, in my opinion, this issue needs to be closed as resolved.

Correct. And it's also noted in readme https://electronjs.org/docs/tutorial/notifications#windows. So, in my opinion, this issue needs to be closed as resolved.

Yes, this one needs to be marked as SOLVED.

Can someone provide what the code should be ? I can't manage to make it work 😞

Currently I just have this :

if (isDev) {
  app.setAppUserModelId('com.electron.pomodoro')
}

And it works in development mode, but what should I do in production ? How to create shortcuts etc...

Thank's for any help ! 😄

@KeziahMoselle I am always setting app id and using electron-builder to package and it works fine

@hovancik Thank's, you are right ! That was really simple

Still can not work on electron 4.1.1 notification api

@samuelcarreira , @quietnumeric

To start up the notifications you will need to create an installer and install the app. At least for me that was the only way they started working (after the actual install) . After that my app was showing up in notification settings on windows 10 as well.

To create an installer I used electron-builder. And as in their example I set appId in package.json and setAppUserModelId in the main process.

https://github.com/electron-userland/electron-builder#quick-setup-guide

Work beautifully after following this guide (electron 4.1.3)

It's finally working!

app.on('ready', () => {
  app.setAppUserModelId("xxx.yyy.zzz"); // set appId from package.json
  autoUpdater.checkForUpdatesAndNotify();
});

@timsazon When you say the appId from package.json, do you mean the appId we set for electron-builder?

Edit: @phanmn solution worked like a charm! Everything started working even in dev mode.

@felixrieseberg We ship our app using electron-packager, I don't think we use squirrel. The app id I used was the one in package.json build.appId.

build.appId is an electron-builder property not electron-packager as far as I can tell. I'm using electron-packager today and have not had notifications work on the built .exe file even with the app.setAppUserModelId('some-identifier-here')

Hi,
Is there any update on this. Unknowingly, I also created an issue. I also use "electron-packager": "^12.2.0",
https://github.com/electron/electron/issues/22061
The notification does not work

Any info on this issue ?

@Praveer1981, please read back. This issue has already been resolved with the proper shortcut and the GUID of the App.

@roelpaulo Thanks. Could you please tag me to correct answer. Where can I find GUIID. I used electron-packager.Unknowingly, I had also created an issue
https://github.com/electron/electron/issues/22061

@Praveer1981, you could take a look at this:
https://electronjs.org/docs/api/app#appsetappusermodelidid-windows
and/or this:
https://github.com/electron/electron/issues/10864#issuecomment-387950259
and/or this:
https://github.com/electron/electron/issues/10864#issuecomment-382519150
and as stated here:
https://electronjs.org/docs/tutorial/notifications#windows

Please take some time to read back because some might work for you and sometimes not depending on the scenario you are in but for the most part, having the proper shortcut and GUID/appID when packaged or setting app.setAppUserModelId('some-identifier-here') works on all version of Windows. Cheers.

Yup. Used that method since 2018. No trouble to this day.

@roelpaulo Thanks for the guidance. I will check this hope it will solve my problem

@roelpaulo I am still trying to fix the notification issue
I also cloned https://github.com/electron/electron-api-demos and found that the notification is not working here as well

Did you try the method in my old comment that @roelpaulo tagged? I just tried it and works like perfectly. I discovered that method pretty much by chance and fortunately it has become a permanent solution. Setting the AppUserModelId is essential but it should just be your execPath. Show us your process. Also refer the first part of my comment - https://github.com/electron/electron/issues/10864#issuecomment-387305417

@m4heshd Thanks for your comment. Yes, I tried what @roelpaulo mentioned. Could you please have a look on my code (which is not working )
https://github.com/electron/electron/issues/22061

Your code won't work because It's not updated with the solution I explained on that comment. Add these lines on top of your code (right after app is created).

const path = require('path');
app.setAppUserModelId(path.join(__dirname, 'node_modules', 'electron', 'dist', 'electron.exe'));

Before you try this, you need to add a shortcut of that electron.exe to your start menu which is located at C:\Users\YOUR_USER_NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs. Just open that above mentioned path on explorer and drag and drop the electron.exe shortcut to Programs folder and try a notification.

@m4heshd I do not understand why do we nee to give electron.exe path.
We download the app from the microsoft store which automatically gets install in start menu->programs In this case how app.setAppUserModelId(path.join(__dirname, 'node_modules', 'electron', 'dist', 'electron.exe')); would be useful ?
During development we use script to install the app.

@felixrieseberg It doesnot look like electron-windows-notification works

@Praveer1981, I myself do not understand at first but it is the requirement that MS put on every app to have a proper shortcut and GUID in order for the notifications to work. As I understand as a whole, it is a requirement, not a code work-around.

@felixrieseberg We ship our app using electron-packager, I don't think we use squirrel. The app id I used was the one in package.json build.appId.

build.appId is an electron-builder property not electron-packager as far as I can tell. I'm using electron-packager today and have not had notifications work on the built .exe file even with the app.setAppUserModelId('some-identifier-here')

@Kikketer Did you manage to get the solution/workaround ?

Thank you for taking the time to report this issue and helping to make Electron better.

The version of Electron you reported this on has been superseded by newer releases.

If you're still experiencing this issue in Electron 6.x.y or later, please add a comment specifying the version you're testing with and any other new information that a maintainer trying to reproduce the issue should know.

I'm setting the blocked/need-info label for the above reasons. This issue will be closed 7 days from now if there is no response.

Thanks in advance! Your help is appreciated.

@electron-triage I have pushed the source code in my gitgub:
https://github.com/Praveer1981/electron-quick-start
I found that the Notification works well in Below machine configuration
OS Name Microsoft Windows 10 Pro
Version 10.0.18362 Build 18362
Other OS Description Not Available
OS Manufacturer Microsoft Corporation
System Name DESKTOP-9TCQVQ0
System Manufacturer Dell Inc.
System Model Inspiron 5570
System Type x64-based PC
System SKU 0810
Processor Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz, 1992 Mhz, 4 Core(s), 8 Logical Processor(s)
BIOS Version/Date Dell Inc. 1.2.3, 15/5/2019
SMBIOS Version 3.0
Embedded Controller Version 255.255
BIOS Mode UEFI
BaseBoard Manufacturer Dell Inc.
BaseBoard Product 0YDF7T
BaseBoard Version A00
Platform Role Mobile
Secure Boot State On
PCR7 Configuration Elevation Required to View
Windows Directory C:\WINDOWS
System Directory C:\WINDOWS\system32
Boot Device \Device\HarddiskVolume5
Locale United States
Hardware Abstraction Layer Version = "10.0.18362.628"

However, It does not work in the PC which has below configuration
OS Name Microsoft Windows 10 Enterprise N
Version 10.0.17763 Build 17763
Other OS Description Not Available
OS Manufacturer Microsoft Corporation
System Name xxxxxxxx
System Manufacturer LENOVO
System Model 30BBS1430Q
System Type x64-based PC
System SKU LENOVO_MT_30BB_BU_Think_FM_ThinkStation P720
Processor Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz, 2295 Mhz, 12 Core(s), 24 Logical Processor(s)
Processor Intel(R) Xeon(R) Gold 5118 CPU @ 2.30GHz, 2295 Mhz, 12 Core(s), 24 Logical Processor(s)
BIOS Version/Date LENOVO S04KT28A, 25-Jul-18
SMBIOS Version 3.0
Embedded Controller Version 18.29
BIOS Mode UEFI
BaseBoard Manufacturer LENOVO
BaseBoard Product 1037
BaseBoard Version SDK0Q40104 WIN 3305665676457
Platform Role Workstation
Secure Boot State On
PCR7 Configuration Elevation Required to View
Windows Directory C:\WINDOWS
System Directory C:\WINDOWS\system32
Boot Device DeviceHarddiskVolume1
Locale United States
Hardware Abstraction Layer Version = "10.0.17763.1007"

I have tried with below version of NODE
v10.13.0
v12.16.1

I managed to solve the problem in my real application:
I had to get the application Id from the AppXManifest.xml:
<Application Id="XXXXX">
main.js
const app = require("electron");
app.setAppUserModelId("XXXXX");

I encountered the same problem I did not receive any notification in windows until I separated the notification call with the show() function like this

const {Notification} = require("electron");

var notif = new Notification({
        title:"APP NAME"
        body:"BODY HERE"
      })

      notif.show()

I encountered the same problem I did not receive any notification in windows until I separated the notification call with the show() function like this

const {Notification} = require("electron");

var notif = new Notification({
        title:"APP NAME"
        body:"BODY HERE"
      })

      notif.show()

This worked for me. I also had setAppUserModelId set as well.

I encountered the same problem I did not receive any notification in windows until I separated the notification call with the show() function like this

const {Notification} = require("electron");

var notif = new Notification({
        title:"APP NAME"
        body:"BODY HERE"
      })

      notif.show()

This worked for me. I also had setAppUserModelId set as well.

Hey @Tepexic, can I know how do set the package.json? And what value did you pass into setAppUserModelId? Is it appId or process.execPath? Thanks

Your code won't work because It's not updated with the solution I explained on that comment. Add these lines on top of your code (right after app is created).

const path = require('path');
app.setAppUserModelId(path.join(__dirname, 'node_modules', 'electron', 'dist', 'electron.exe'));

Before you try this, you need to add a shortcut of that electron.exe to your start menu which is located at C:\Users\YOUR_USER_NAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs. Just open that above mentioned path on explorer and drag and drop the electron.exe shortcut to Programs folder and try a notification.

Hey @m4heshd, I tried to use the method you mentioned, https://www.electronjs.org/docs/tutorial/notifications#windows. But I still can not get the notification. I used Windows 10.

autoUpdater.setFeedURL(feedUrl);
autoUpdater.on("update-available", (info: UpdateInfo) => {
    new Notification({
      title: "APP NAME",
      body: "APP BODY"
    }).show();
  });
  app.setAppUserModelId(process.execPath);
  return autoUpdater.checkForUpdates();

Can I know how to fix that?

I encountered the same problem I did not receive any notification in windows until I separated the notification call with the show() function like this

const {Notification} = require("electron");

var notif = new Notification({
        title:"APP NAME"
        body:"BODY HERE"
      })

      notif.show()

This worked for me. I also had setAppUserModelId set as well.

Hey @Tepexic, can I know how do set the package.json? And what value did you pass into setAppUserModelId? Is it appId or process.execPath? Thanks

I did it manually, like this:
// Set id app.setAppUserModelId('com.example.AppNameHere')

I don't have anything special on the package.json, other than this:
"name": "app-name-here"

app-name-here

Gotcha, since I did not set the appId in the package.json. I set the appId in electron-builder.yml according to this tutorialhere.

I tried this code change, but it did not work for me. Can I know if I miss something? Thanks!

OS: Window 10
Electron: 7.0.0

app.setAppUserModelId("appId");
autoUpdater.on("update-available", (info: UpdateInfo) => {
    new Notification({
      title: "APP NAME",
      body: "APP BODY"
    }).show();
  });
return autoUpdater.checkForUpdates();
Was this page helpful?
0 / 5 - 0 ratings