Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Bug]: (Push-Notification) Registration listener returns old Token if register is called immediatly after unregister

Open
#2,593 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 9 days

@ciccilleju is already working on this.

Since Oct 5, 2026.

  • #2607 by @ciccilleju — open

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Domain
mobile-dev

Research direction

Start with the linked StackBlitz reproduction and run it on Android, focusing on the addListener → unregister → register sequence. Then trace the Android implementation of @capacitor/push-notifications and its registration event path. Done means each register call after unregister delivers a newly issued token rather than the previous token, with coverage for the alternating behavior.

Written by the indexing model from the issue text.

Description

platform: android triage
Capacitor Version

Capacitor Doctor

Latest Dependencies:

@capacitor/cli: 8.5.1
@capacitor/core: 8.5.1
@capacitor/android: 8.5.1
@capacitor/ios: 8.5.1

Installed Dependencies:

@capacitor/core: 8.4.0
@capacitor/android: 8.4.0
@capacitor/cli: 8.4.0
@capacitor/ios: 8.4.0
@capacitor/push-notifications: 8.0.3

[success] Android looking great! 👌
[error] Xcode is not installed

Other API Details
npm --version output: 11.12.1
node --version output: 24.16.0
Platforms Affected
  • iOS
  • Android
  • Web
Current Behavior

If we call register immediatly after having called unregister, we get the already existing token again.
This behaviour can be reproduced every second time this sequence is called.

await PushNotifications.addListener('registration', (token: Token) => {...});
await PushNotifications.unregister();
await PushNotifications.register();
Expected Behavior

We get a new Token everytime we call await PushNotifications.register();

Project Reproduction

https://stackblitz.com/edit/angular-4zsdop-napdpb7a?file=src%2Fapp%2Fapp.component.ts,src%2Fapp%2Fapp.component.html

Additional Information

The reproduction is only theoretical since a real setup requires a running Android System.

In our App we would like to give the User the option to exchange the existing token with a new one.

Dominant language
Java
Stars
683
Forks
692
Avg merge
11d 16h
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ionic-team/capacitor-plugins

All issues in ionic-team/capacitor-plugins

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.