Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification.show() does not show the notification message #22061

Closed
3 tasks
Praveer1981 opened this issue Feb 6, 2020 · 5 comments
Closed
3 tasks

Notification.show() does not show the notification message #22061

Praveer1981 opened this issue Feb 6, 2020 · 5 comments

Comments

@Praveer1981
Copy link

Praveer1981 commented Feb 6, 2020

Preflight Checklist

  • I have read the Contributing Guidelines for this project.
  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Issue Details

I have upgraded the electron version from 6.0.12 to 7.1.1. And I found that Notification feature stopped working.

  • Electron Version:
    7.1.1
  • Operating System:
    Windows 10 Enterprise
  • Last Known Working Electron version:
    6.1.12

Expected Behavior

It should be able to shoe the Notification message at the bottom right corner of the screen.

Actual Behavior

Its not showing the notification message.

To Reproduce

Screenshots

Additional Information

I was showing the notification message when my app download the file successfully.
Below code was working earlier:
app.setAppUserModelId(); What is the significance of , Generally where do we get it from ?
Below is the code We have in the main process[Note: It works well with electron:6.1.12, but does not work with electron 7.1.1]

    const {Notification} = require("electron");
    item.once("done", (_event, state) => {
      downloadItems.delete(item)
      if (!mainWindow.isDestroyed() && downloadItems.size == 0) {
        setTimeout(() => {
          // Starts flashing the window to attract user's attention.
          mainWindow.flashFrame(true)
          mainWindow.setProgressBar(0, {
            mode: "none"
          })
        }, 2000)
      }

      if (state === "completed") {
        let notification = new Notification({
          title: appName,
          body: suggestPath
        });

        // handle on click event of notification
        notification.on("click", () => {
          shell.showItemInFolder(suggestPath);
        });
        notification.show();
      } else {
        console.log(`Download failed: ${state}`)
      }
    })
@Praveer1981
Copy link
Author

@roelpaulo @m4heshd It seems in my above code notification.show(); is not working. Do you guys have any idea about it ?

@Praveer1981
Copy link
Author

@roelpaulo @m4heshd I want to use the Notification class as mentioned here
https://www.electronjs.org/docs/api/notification#class-notification

@MarshallOfSound
Copy link
Member

Please see the requirements for showing a notification on windows

@xlzhou1
Copy link

xlzhou1 commented Jul 23, 2020

@roelpaulo @m4heshd I want to use the Notification class as mentioned here
https://www.electronjs.org/docs/api/notification#class-notification

Dose your app notification work for you? Same issue for me.

@mqliutie
Copy link

In my case, I used Notification Web API.
onshow callback is triggered but the message box can not be shown on macOS...
Performance>Notification>MyApp is enabled...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants