I ran into the same problem. Simply put, PushPlugin does not support this feature. But you can easily change it to suit your needs.
How does it work now
When a message is received by the GCMIntentService plugin, GCMIntentService is called . This method retrieves all the additional parameters passed to it, storing them in extras . After that, if the application is in the foreground, this function simply passes extras you, calling sendExtras . Otherwise, it calls createNotification , which actually creates a notification in the status bar.
Your problem
From what I understood from your question, a warning is not received if, after receiving a notification in the status bar, you open the application without touching the notification.
Here's what happens:
GCMIntentService receives a message- Since your application is in
background , PushPlugin calls createNotification - When you start the application, it does not receive a warning, because you have not yet touched the notification in the status bar
You would receive a notification if you touched the notification because the intent of the notification has awakened your application. When your application wakes up, it searches for cached extra ones and then transfers them to your application, again calling sendExtras .
Decision
I have not tested this yet, but I strongly believe that if you edit your plugin, before sendExtras before (or after) you call createNotification , the data will be cached for your application, regardless of whether to notify or delete it.
protected void onMessage(Context context, Intent intent) { Log.d(TAG, "onMessage - context: " + context); // Extract the payload from the message Bundle extras = intent.getExtras(); if (extras != null) { // if we are in the foreground, just surface the payload, else post it to the statusbar if (PushPlugin.isInForeground()) { extras.putBoolean("foreground", true); PushPlugin.sendExtras(extras); } else { extras.putBoolean("foreground", false); // Send a notification if there is a message if (extras.getString("message") != null && extras.getString("message").length() != 0) { createNotification(context, extras); } } } }
Change the section above:
protected void onMessage(Context context, Intent intent) { Log.d(TAG, "onMessage - context: " + context); Bundle extras = intent.getExtras(); if (extras != null) { if (PushPlugin.isInForeground()) { extras.putBoolean("foreground", true); } else { extras.putBoolean("foreground", false); if (extras.getString("message") != null && extras.getString("message").length() != 0) { createNotification(context, extras); } }