question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: PushNotifications is missing the removeAllListeners function

See original GitHub issue

Bug Report

Capacitor Version

npx cap doctor output:

Installed Dependencies:

  @capacitor/core 1.5.1

  @capacitor/cli 1.5.1

  @capacitor/android 1.5.2

  @capacitor/ios 1.5.2


[success] Android looking great! 👌
  Found 4 Capacitor plugins for ios:
    capacitor-fcm (2.0.0)
    cordova-plugin-add-swift-support (1.7.2)
    cordova-plugin-file (6.0.2)
    cordova-plugin-photo-library (2.2.1)
[success] iOS looking great! 👌

Affected Platform(s)

  • Android
  • iOS
  • Electron
  • Web

Current Behavior

  1. PushNotifications.removeAllListeners is not a function.

  2. PushNotifications.requestPermissions returns an empty object.

Expected Behavior

  1. Removes all listeners.

  2. Returns an object with granted property.

Sample Code or Sample Application Repo

PushNotifications.removeAllListeners();

Other Technical Details

When I do console.log(Object.keys(PushNotifications)), I get only:

[
"addListener",
"listChannels",
"removeDeliveredNotifications",
"createChannel",
"getDeliveredNotifications",
"requestPermissions",
"removeAllDeliveredNotifications",
"deleteChannel",
"register"
]

But in the docs, there is a removeAllListeners method?

npm --version output:

6.13.1

node --version output:

v13.2.0

pod --version output (iOS issues only):

1.8.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jcesarmobilecommented, Apr 20, 2020

In capacitor 1 calling register also requested the permission, but doesn’t do it in Capacitor 2.

But please, don’t keep asking questions on github issues.

For questions you can ask on the forum, slack or stack overflow using capacitor tag.

0reactions
ionitron-bot[bot]commented, Nov 12, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Push Notifications Capacitor Plugin API
On iOS, the first time you use the function, it will prompt the user for push notification permission and return granted or denied...
Read more >
App Missing from Settings -> Notifications list - Apple Developer
We are receiving myriad complaints from members that our app is now missing from Settings -> Notifications, and so our members cannot receive...
Read more >
Javascript removeEventListener not working - Stack Overflow
Your removeEventListener 's argument is not a reference to the function object that was previously attached. function foo(event) { app.addSpot(event.clientX, ...
Read more >
Beginners guide to Web Push Notifications using Service ...
In this post we will look at how to implement push notifications for the web… ... Error DOMException: Registration failed - missing ...
Read more >
Handling Events in Node.js with EventEmitter - Stack Abuse
They both have the same effect. removeAllListeners(). Again, as the name suggests - this function will remove all listeners from all events of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found