I have followed instructions to set up an Android GCM client app here, and have a problem specifically with this excerpt:
For existing apps that exten
@SamStern answered this question for me, when I posted it on a Google Samples github wiki:
So there are two kinds of GCM messages:
Notification Messages - these are intended to generate a notification with no intermediate processing by the application. They only hit onMessageReceived if the app is running.
Data Messages - these are intended to silently pass data to the app's messaging service. They hit onMessageReceived even if the app is in the background. The service may then choose to generate a notification using the normal system notification APIs, or it may choose to handle the message silently.
My takeaway is that if a client app wants to customize how a notification is presented to the user (i.e. change the icon in the notification tray, play a sound depending on sound settings in the app's shared preferences, etc), then we have to make the server send "Data Messages" instead of "Notification Messages". Here's the implementation in a Google Samples project, showing how to handle a Data Message.