Guilherme,
Actually leaving apps and threads running in the background with open connections is not recommended. Imagine if every app had an open port and an established connection waiting for a response from the server? In a mobile environment where the 3G connection is often very slow, it would clog the network, and the user would not be able to navigate efficiently. So from there, Google has created a server bus that makes this communication to us, thus avoiding congestion in case the internet connection is too bad.
This bar is called GCM (Google Cloud Messaging), quoted in the comments by our friend Wakim.
It works as follows:
The app registers to your GCM account and a Key is generated
Your app should deliver this Key to your server that wants to communicate with the app
The server sends a notification to the GCM server with the key of your application
GCM queues notifications and delivers them to your mobile phone
Your phone's notification service delivers the notification to your code.
That is, the servers communicate with GCM and GCM with your cellphone, this means that the cell phone only needs an open connection: that of GCM. This allows me to scale and avoids connection problems. This is how facebook apps and whatsapp works. Your app does not need to stay open, and you do not need background threads listening for connections, you just need to set up a service in your app and the operating system does the rest.
Obviously my explanation is very brief, and very superficial. You can find more details on this HERE , with explanations of how to implement the customer part and the part of the server and more.
You can also find a very well-explained video tutorial HERE .
I hope I have helped !!!