Search code examples
androidpush-notificationibm-mobilefirst

Notifications sample only showing the last received on Android


I'm running the Worklight's Notifications sample. I invoke the adapter to send a notification to the application, and it shows the notification into the top bar perfectly.

But when I send another notification, it don't stack with the previous one, it overwrites with the new one.

And I don't want that it being overwriten. How can I solve this?


Solution

  • This is a limitation that is currently imposed (by default) by Worklight.

    In essence, in Worklight there is internally a GCMIntentService class that listens for received notifications and if received, creates and sends to the OS an object with a static ID. This is repeated for every incoming notification, replacing the previously received notification.

    What you can do is:

    1. Submit a feature request to be evaluated by Worklight's product designers: http://www.ibm.com/developerworks/rfe/

    2. In your project, there is an empty class in android\native\src\com\app-name\GCMIntentService.java. What you could try to do, is basically implement your own "push mechanism" based on Google's documentation to have all notifications display rather than just the last received notification by not using a static id like how it is currently implemented in Worklight.