GcmTaskService not triggered for some users

114 Views Asked by At

We are using GcmTaskService for uploading entities created by the user asynchronously to our server.

This is working for couple of thousands of users without any issues, but for at least two users the tasks get scheduled but will never run.

We use this code to schedule the task (scheduling is a custom object holding some parameters required to schedule the task):

// Build the OneOffTask
OneoffTask task = new OneoffTask.Builder()
            .setExecutionWindow(2, 5)
            .setService(MyGcmTaskService.class)
            .setTag(scheduling.getTag())
            .setUpdateCurrent(true)
            .setRequiredNetwork(scheduling.isWiFiRequired() ? OneoffTask.NETWORK_STATE_UNMETERED : OneoffTask.NETWORK_STATE_CONNECTED)
            .setExtras(scheduling.getExtrasBundle())
            .build();

// Schedule it
this.mManager.schedule(task);

We are using com.google.android.gms:play-services-gcm:9.8.0. Thanks!

1

There are 1 best solutions below

0
On

Check if the phone has activated Battery Optimization for this application (DOZE). It ignores all app which could be a threat to the battery, like background services.

https://es.verizonwireless.com/support/knowledge-base-202636/