Google Cloud Messaging (GCM) is a service that allows sending of push notifications from servers to Android devices. It uses an ID received during registration to send notifications even if the app is not active. Notifications are delivered near real-time with low battery usage. GCM requires Android 2.2+, Google Play Services, and a Google account on older devices. Developers must register their app project, get an API key, and handle registration and receiving of notifications within their app.
2. Google Cloud Messaging
Aggiornare i dati delle APP:
● Polling;
● Notifiche PUSH.
Vantaggi delle notifiche PUSH:
● Minor consumo di risorse (batteria/banda);
● Aggiornamenti (quasi) real-time;
● L'applicazione non deve essere attiva.
3. Google Cloud Messaging
Limiti/richieste di GCM:
● Android 2.2 o superiore;
● Google Play Store installato;
● L'utente deve avere almeno un profilo
Google configurato (per versioni < 4.0.4);
● Payload dal server alle app limitato (~4K).
6. Google Cloud Messaging
Prima di cominciare:
https://code.google.com/apis/console
1. Prendete nota dell'ID del progetto (nella URL);
2. Attivate il servizio Google Cloud Messaging;
3. Create una nuova chiave per il server.
7. Google Cloud Messaging
Android side:
1. Registrare il device sui server GCM;
2. Ottenere il device ID;
3. Inviare il device ID al proprio server;
4. Attendere le notifiche!