Giter Club home page Giter Club logo

Comments (9)

macdonst avatar macdonst commented on July 20, 2024

@natanaelmaia Sounds like a bug. Can you give me a more detailed reproduction scenario so when I have time to look at this I can go right to the problem?

from phonegap-plugin-push.

natanaelmaia avatar natanaelmaia commented on July 20, 2024

@macdonst, I sent two push notifications to the app. The first one with notId=0 and the last one with notId=1. When I tapped the first notification sent (notId=0), the push.on(’notification’) function was called with notId=1. The other notification also had disappeared from status bar.
This only happend in Android.
Thanks!

from phonegap-plugin-push.

fredgalvao avatar fredgalvao commented on July 20, 2024

Seems like this tracks back to this issue where @sinedied mentions that creating different notIds only makes showing multiple notifications possible, not handling them all accordingly. We need to inform a different requestCode for each notification for them to be able to trigger different actions. This behaviour is described in details here:

If you truly need multiple distinct PendingIntent objects active at the same time (such as to use as two notifications that are both shown at the same time), then you will need to ensure there is something that is different about them to associate them with different PendingIntents. This may be any of the Intent attributes considered by Intent.filterEquals, or different request code integers supplied to getActivity(Context, int, Intent, int), getActivities(Context, int, Intent[], int), getBroadcast(Context, int, Intent, int), or getService(Context, int, Intent, int).

Changing https://github.com/phonegap/phonegap-plugin-push/blob/master/src/android/com/adobe/phonegap/push/GCMIntentService.java#L96 from

PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

to

int requestCode = new Random().nextInt();
PendingIntent contentIntent = PendingIntent.getActivity(this, requestCode, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

fixes it.

Please take a look into it! Looking forward to 1.1.2 with this!

from phonegap-plugin-push.

macdonst avatar macdonst commented on July 20, 2024

You guys are the best. I may get a chance to look into this tonight.

from phonegap-plugin-push.

macdonst avatar macdonst commented on July 20, 2024

@fredgalvao thanks, I tested and merged your change today. It'll show up in the next plugin release officially bug you can clone this repo to get the latest.

from phonegap-plugin-push.

fredgalvao avatar fredgalvao commented on July 20, 2024

I appreciate the quick response, and I'm glad I could help!
Now onto that bigText thing on android...

from phonegap-plugin-push.

VaishaliRavindran avatar VaishaliRavindran commented on July 20, 2024

I am having notifications with different notId and when I select a notification the corresponding actions are executed correctly, But other notifications with different notIds are disappearing from notification tray in android when app is in foreground

from phonegap-plugin-push.

fredgalvao avatar fredgalvao commented on July 20, 2024

@VaishaliRavindran Have you tried reading/changing the value of android.clearNotifications on your init options?
https://github.com/phonegap/phonegap-plugin-push/blob/master/docs/API.md#android

Also, if your issue persists, please create a new issue, as your case is not really the same as this issue. (edit) I see you have indeed created a new issue, so please ignore this last paragraph.

from phonegap-plugin-push.

lock avatar lock commented on July 20, 2024

This thread has been automatically locked.

from phonegap-plugin-push.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.