Executing tasks with GCM Network Manager

Beyond the messaging framework, the GCM library comes with GcmNetworkManager, an API that allows us to efficiently schedule recurrent or periodic tasks on all the devices that run API level 9 (Android 2.1) and above. For devices running on API Level 21 (Lollipop) and above, GCM Network Manager uses the native JobScheduler API internally, covered in detail in Chapter 7, Exploring the JobScheduler API. In the same way as the JobScheduler API, it will try to batch the jobs and reduce the number of wakeups from idle state to improve the battery life of your user's device.

Moreover, with GCM Network Manager we are also able to set criteria that should meet to start the job execution, such as when the device is ...

Get Asynchronous Android Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.