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

it is not possible to delete active push notifications individually - push-notifications #740

Closed
ahoyahoy opened this issue Dec 19, 2021 · 4 comments

Comments

@ahoyahoy
Copy link

ahoyahoy commented Dec 19, 2021

Bug Report

Plugin(s)

push-notifications

Capacitor Version

Latest Dependencies:

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

Installed Dependencies:

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

[error] Xcode is not installed

Platform(s)

android
ios

The Problem

PushNotifications.removeDeliveredNotifications([msg])

This doesn't work at all.

Android

Android notification api expects Int message_id. But the system gets id in the form 0:1639932623809889%d78dae59d78dae59.
This will also cause the id of each background message to be stored as 0

Nothing happens on android when I call a function removeDeliveredNotifications

  • no message is removed
  • no error exception
native PushNotifications.removeDeliveredNotifications (#77663661)
    Object
        callbackId: "77663661"
        methodName: "removeDeliveredNotifications"
        options: Array(1)
            0:
                body: "body text"
                data: Object
                groupSummary: false
                id: 0
                title: "Test alert"    
        pluginId: "PushNotifications"

result PushNotifications.removeDeliveredNotifications (#77663661)
    undefined

I can't figure out how to capture an incoming background message and edit id to int

  • Emulator android Pixel 5 API 28 (Android 9)
  • Real android One Plus 7 Pro (Android 11)

ios

I don't have an apple dev environment.
Only testflight and real Iphone 8.
And there I get error Must supply notifications to remove

@jcesarmobile
Copy link
Member

Can you provide a sample app where the issue can be reproduced?

@MicheleOrdile
Copy link

I encounter the same problem, this is a serious bug because it causes an exception in the native code

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
        at com.capacitorjs.plugins.pushnotifications.PushNotificationsPlugin.removeDeliveredNotifications(PushNotificationsPlugin.java:163)
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:121) 
        at com.getcapacitor.Bridge.lambda$callPluginMethod$0$Bridge(Bridge.java:584) 
        at com.getcapacitor.-$$Lambda$Bridge$25SFHybyAQk7zS27hTVXh2p8tmw.run(Unknown Source:8) 
        at android.os.Handler.handleCallback(Handler.java:938) 
        at android.os.Handler.dispatchMessage(Handler.java:99) 
        at android.os.Looper.loop(Looper.java:254) 
        at android.os.HandlerThread.run(HandlerThread.java:67) 

For all those who have implemented a logic that provides for the removal of the single notification read, the application will crash for each notification received.

@jcesarmobile
Copy link
Member

this has been fixed in 4.0.0 beta 0

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 30, 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 the plugin, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants