I have my app that receives a GCM message from the server. I got all that working with notification coming up.

My issue is that if the app is open then I don't want to show notification and just display show the message withing the app. But if the app is closed then I need to show notification ( like a chat app).

How can I do this determination?

Thanks