GcmTaskService : Implemented by the client application to provide an endpoint for the GcmNetworkManager to return to when the task is ready to be completed. Tasks should be scheduled based on the execution window in time. During this run window, the scheduler will use its discretion to select the optimal run time based on network availability, network activity, and load.
The synchronization adapter synchronizes data between the server and the local database. Synchronization adapters run asynchronously; they transmit data regularly and efficiently, but not instantly. If you need real-time data transfer, you should do it in AsyncTask or IntentService. This structure helps manage and automate data transfer and coordinate synchronization operations across applications.
Google Cloud Messaging (GCM) provides both the server and the devices needed to run this messaging system. Using GCM to initiate transmissions is more reliable and more efficient than polling server for status. During polling, a Service that is always active is required; GCM uses the BroadcastReceiver, which is activated when a message arrives. While polling at regular intervals uses battery power, even if updates are not available, GCM sends messages only when necessary.
Verma
source share