SOLFIND
Web Lens
Portal home

pushNotifications | Electron

https://www.electronjs.org/docs/latest/api/push-notifications • 40 KB fetched
Open original page


pushNotifications | Electron Skip to main content Electron Docs API Blog Tools * Electron Forge * Electron Fiddle Community * Governance * Showcase * Resources Releases English * English * Deutsch * Español * Français * 日本語 * Português * Русский * 中文 Search * Main Process Modules * app * autoUpdater * BaseWindow * BrowserView * Deprecated * BrowserWindow * clipboard * contentTracing * crashReporter * desktopCapturer * dialog * globalShortcut * ImageView * inAppPurchase * ipcMain * Menu * MenuItem * MessageChannelMain * MessagePortMain * nativeImage * nativeTheme * net * netLog * Notification * powerMonitor * powerSaveBlocker * process * protocol * pushNotifications * safeStorage * screen * session * sharedTexture * ShareMenu * shell * systemPreferences * TouchBar * Tray * utilityProcess * webContents * WebContentsView * webFrameMain * View * Renderer Process Modules * Utility Process Modules * Custom DOM Elements * Chromium and Node.js * Classes * API Structures * * Main Process Modules * pushNotifications On this page pushNotifications Process: Main Register for and receive notifications from remote push notification services For example, when registering for push notifications via Apple push notification services (APNS): const { pushNotifications , Notification } = require ( 'electron' ) pushNotifications . registerForAPNSNotifications ( ) . then ( ( token ) => { // forward token to your remote notification server } ) pushNotifications . on ( 'received-apns-notification' , ( event , userInfo ) => { // generate a new Notification object with the relevant userInfo fields } ) Events ​ The pushNotification module emits the following events: Event: 'received-apns-notification' macOS ​ Returns: * event Event * userInfo Record<String, any> Emitted when the app receives a remote notification while running. See: https://developer.apple.com/documentation/appkit/nsapplicationdelegate/1428430-application?language=objc Methods ​ The pushNotification module has the following methods: pushNotifications.registerForAPNSNotifications() macOS ​ Returns Promise<string> Registers the app with Apple Push Notification service (APNS) to receive Badge, Sound, and Alert notifications. If registration is successful, the promise will be resolved with the APNS device token. Otherwise, the promise will be rejected with an error message. See: https://developer.apple.com/documentation/appkit/nsapplication/1428476-registerforremotenotificationtyp?language=objc pushNotifications.unregisterForAPNSNotifications() macOS ​ Unregisters the app from notifications received from APNS. Apps unregistered through this method can always reregister. See: https://developer.apple.com/documentation/appkit/nsapplication/1428747-unregisterforremotenotifications?language=objc Edit this page Previous protocol Next safeStorage * Events * 'received-apns-notification' * Methods * registerForAPNSNotifications * unregisterForAPNSNotifications Docs * Getting Started * API Reference Checklists * Performance * Security Tools * Electron Forge * Electron Fiddle Community * Governance * Resources * Bluesky * X * Mastodon * Stack Overflow More * GitHub * Open Collective * Infrastructure Dashboard Copyright OpenJS Foundation and Electron contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation , please see our Trademark Policy and Trademark List . Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them. The OpenJS Foundation | Terms of Use | Privacy Policy | Bylaws | Code of Conduct | Trademark Policy | Trademark List | Cookie Policy Hosting and infrastructure graciously provided by

Links found on this page

  1. Skip to main content [direct]
  2. Electron [direct]
  3. Docs [direct]
  4. API [direct]
  5. Blog [direct]
  6. Electron Forge [direct]
  7. Electron Fiddle [direct]
  8. Governance [direct]
  9. Showcase [direct]
  10. Resources [direct]
  11. Releases [direct]
  12. Deutsch [direct]
  13. Español [direct]
  14. Français [direct]
  15. 日本語 [direct]
  16. Português [direct]
  17. Русский [direct]
  18. 中文 [direct]
  19. autoUpdater [direct]
  20. BaseWindow [direct]
  21. BrowserView Deprecated [direct]
  22. BrowserWindow [direct]
  23. clipboard [direct]
  24. contentTracing [direct]
  25. crashReporter [direct]
  26. desktopCapturer [direct]
  27. dialog [direct]
  28. globalShortcut [direct]
  29. ImageView [direct]
  30. inAppPurchase [direct]
  31. ipcMain [direct]
  32. Menu [direct]
  33. MenuItem [direct]
  34. MessageChannelMain [direct]
  35. MessagePortMain [direct]
  36. nativeImage [direct]
  37. nativeTheme [direct]
  38. net [direct]
  39. netLog [direct]
  40. Notification [direct]
  41. powerMonitor [direct]
  42. powerSaveBlocker [direct]
  43. process [direct]
  44. protocol [direct]
  45. safeStorage [direct]
  46. screen [direct]
  47. session [direct]
  48. sharedTexture [direct]
  49. ShareMenu [direct]
  50. shell [direct]
  51. systemPreferences [direct]
  52. TouchBar [direct]
  53. Tray [direct]
  54. utilityProcess [direct]
  55. webContents [direct]
  56. WebContentsView [direct]
  57. webFrameMain [direct]
  58. View [direct]
  59. Custom DOM Elements [direct]
  60. Chromium and Node.js [direct]
  61. Classes [direct]
  62. API Structures [direct]
  63. Main [direct]
  64. https://developer.apple.com/documentation/appkit/nsapplicationdelegate/1428430-application?language=objc [direct]
  65. Badge, Sound, and Alert [direct]
  66. https://developer.apple.com/documentation/appkit/nsapplication/1428476-registerforremotenotificationtyp?language=objc [direct]
  67. https://developer.apple.com/documentation/appkit/nsapplication/1428747-unregisterforremotenotifications?language=objc [direct]
  68. Edit this page [direct]
  69. Performance [direct]
  70. Security [direct]
  71. Bluesky [direct]
  72. X [direct]
  73. Mastodon [direct]
  74. Stack Overflow [direct]
  75. GitHub [direct]
  76. Open Collective [direct]
  77. Infrastructure Dashboard [direct]
  78. OpenJS Foundation [direct]
  79. Trademark Policy [direct]
  80. Trademark List [direct]