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

Add clearLocalNotification method #711

Merged
merged 1 commit into from
Jul 4, 2018

Conversation

FlorianGerhardt
Copy link
Contributor

As discussed in #371 there is no way to remove a notification from the notification centre.
This PR adds a method that removes a notification by id from the centre.

@TheBerg
Copy link

TheBerg commented Apr 12, 2018

This is great, I was just looking into this.

We should probably also support removing via a tag too.

     * Cancel a previously shown notification.
     * @param tag the string identifier of the notification.
     * @param id the ID of the notification
     */
    public void cancel(@Nullable String tag, int id)

Let me know if you need help. :)

@Gp2mv3 Gp2mv3 merged commit 0bcc9ac into zo0r:master Jul 4, 2018
@rstiyer
Copy link

rstiyer commented Aug 1, 2018

Could you please give an example of how to use this function?

I've tried calling PushNotification.clearLocalNotification(id) and PushNotification.clearLocalNotification({ id }) and neither works for me.

@joshbax
Copy link

joshbax commented Aug 7, 2018

This method only works on Android.
React-native is intended to be a cross platform framework. If you can't avoid adding platform specific functions, at the very least they should be documented or appropriately named (e.g. clearLocalNotificationAndroid())

@noway
Copy link

noway commented Dec 6, 2019

agree with @rstiyer how to use it?

@noway
Copy link

noway commented Dec 6, 2019

this is how:

PushNotification.clearLocalNotification(parseInt(notificationToRemove.androidNotificationId, 10));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants