So from Android SDK for GcmNetworkManager
public static final int RESULT_RESCHEDULE
Indicates a task has failed to execute, and must be retried with back-off.
Task task = new OneoffTask.Builder()
.setService(MyService.class)
.setExecutionWindow(0, 15)
.setUpdateCurrent(true)
.setRequiredNetwork(Task.NETWORK_STATE_CONNECTED)
.setRequiresCharging(false)
.build();
mGcmNetworkManager.schedule(task);
Inside MyService
public int onRunTask(TaskParams taskParams) {
/** task execution logic here */
if (success) {
return RESULT_SUCCESS;
} else {
return RESULT_RESCHEDULE;
}
}
When the execution fails, it will return RESULT_RESCHEDULE, and it will be retried. So I am wondering when will it be retried?
Thanks
Based from this documentation,
RESULT_RESCHEDULE
means that your task failed then reschedules your task, so it will be executed again when conditions are met.However, you may check this tutorial when your code often fails and must be retried. Java 7/8 library provides rich and unobtrusive API with fast and scalable solution to this problem.
Hope this helps!