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

fix(push-notification): notification not dispatching click when received in foreground #1478

Closed
wants to merge 1 commit into from

Conversation

ftheomunhoz
Copy link

Push notifications are missing the intent to allow them to be clickable. Without that, the event pushNotificationActionPerformed will never trigger.

intent.putExtras(remoteMessage.toIntent().getExtras());
PendingIntent pendingIntent = PendingIntent.getActivity(
getContext(),
0,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of 0, consider adding a unique id

NotificationCompat.Builder builder = new NotificationCompat.Builder(
getContext(),
NotificationChannelManager.FOREGROUND_NOTIFICATION_CHANNEL_ID
)
.setSmallIcon(pushIcon)
.setContentTitle(title)
.setAutoCancel(true)
.setContentIntent(pendingIntent)
.setContentText(body)
.setPriority(NotificationCompat.PRIORITY_DEFAULT);
notificationManager.notify(0, builder.build());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the 0 here will potentially overwrite the last notification.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this is a separate issue, right? This 0 (and the newly added one) result in the problem/feature that only one push notification can be shown. But the change in this MR still only adds value to capacitor and doesn't break any existing features, so maybe it would be good to merge this anyway, and deal with the other thing separately?

@ErikBrendel
Copy link

@ftheomunhoz I would very much like this change, as for me, the notification tap event is also missing 👍

@abennouna
Copy link

wow I literally didn't see this PR when I submitted this ionic-team/capacitor#6439

abennouna referenced this pull request in abennouna/capacitor-plugins Mar 28, 2023
abennouna added a commit to abennouna/capacitor-plugins that referenced this pull request Mar 28, 2023
@tanujlight
Copy link

I am also facing the same issue, is this PR going to merge or not

@raymondmuller
Copy link

Tried this today and it works 👍
Using pnpm patch now to automatically apply these changes, but would be great to see this merged asap.

@sawaca96
Copy link

sawaca96 commented Jun 7, 2023

Waiting for PR merge...👏

@phpMagpie
Copy link

Facing some issue with no intent on foreground notifications. Confirm that this patch adds that missing functionality. Any idea when this can be worked on and merged?

@tanuj-g
Copy link

tanuj-g commented Jun 13, 2023

any new update on this?

@trinitiwowka
Copy link

Any news?

@tanuj-g
Copy link

tanuj-g commented Aug 11, 2023

any update on this, waiting for this from last 6 months

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A confirmed bug report
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet