Back to project page inbox-android.
The source code is released under:
MIT License
If you think the Android project inbox-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.inboxapp.androidsdk.apis.taskmanagement; /*w w w . j a va 2 s. c om*/ import android.util.Log; import com.inboxapp.androidsdk.apis.taskmanagement.InboxAppTasks.base.InboxAppTask; import retrofit.Callback; import retrofit.RetrofitError; import retrofit.client.Response; /** * Created by sylvianguessan on 8/13/14. */ public class InboxAppTaskCallback implements Callback{ InboxAppTask mTask; InboxAppTaskQueue mInboxAppTaskQueue; public InboxAppTaskCallback(InboxAppTask task, InboxAppTaskQueue inboxAppTaskQueue) { mTask = task; mInboxAppTaskQueue = inboxAppTaskQueue; } public void success(Object o, Response response) { Log.w("InboxAppTask (executeWithClient)", mTask.mInboxTaskID+" successful"+"\nStatus: "+response.getStatus()); } public void failure(RetrofitError retrofitError) { Log.w("InboxAppTask (executeWithClient)", mTask.mInboxTaskID+" failed with error:" + retrofitError.getMessage()+"\nStatus: "+retrofitError.getResponse().getStatus()); updateQueueStatus(retrofitError.getResponse().getStatus()); } public void updateQueueStatus(int statusCode) { if ((statusCode >= 400) && (statusCode < 500)) { //task should NOT be stored....then proceed to next. Log.w("InboxAppTask (executeWithClient)", "Execute the next task"); mInboxAppTaskQueue.executeNextTask(); } else if (statusCode >= 500) { //task should stored at end of queue....then proceed to next. Log.w("InboxAppTask (executeWithClient)", "Task is appended to queue, the next task is scheduled"); mInboxAppTaskQueue.add(mTask); mInboxAppTaskQueue.executeNextTask(); } else if (statusCode == 0) { //Queue is paused. Log.w("InboxAppTask (executeWithClient)", "Queue auto-processing is paused."); } } }