Class CommunicationTask<T>
-
- Type Parameters:
T
- - return type to use.
- Direct Known Subclasses:
AerisCommunicationTask
,AerisCustomCommunicationTask
,BatchCommunicationTask
,PermissionsTask
public abstract class CommunicationTask<T> extends android.os.AsyncTask<Void,Void,T>
Abstract helper to set up the basics of our threading classes.
-
-
Field Summary
Fields Modifier and Type Field Description protected WeakReference<android.content.Context>
context
protected AerisProgressListener
progressListener
protected AerisRequest
request
-
Constructor Summary
Constructors Modifier Constructor Description protected
CommunicationTask(android.content.Context context, AerisRequest request)
protected
CommunicationTask(AerisRequest request)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected T
doInBackground(Void... params)
T
executeSyncTask()
Execute the task in a non-thead environment.static boolean
isOnline(android.content.Context context)
Checks to see whether or not we have an established connection.protected void
onCancelled()
protected void
onPostExecute(T result)
protected void
onPreExecute()
protected AerisBatchResponse
unknownBatchError()
Message failed to do another reason not including IOException on the network.protected AerisResponse
unknownError()
Message failed to do another reason not including IOException on the network.CommunicationTask<T>
withProgress(AerisProgressListener progressListener)
Creates the task with a progress listener.
-
-
-
Field Detail
-
request
protected AerisRequest request
-
progressListener
protected AerisProgressListener progressListener
-
context
protected WeakReference<android.content.Context> context
-
-
Constructor Detail
-
CommunicationTask
protected CommunicationTask(android.content.Context context, AerisRequest request)
-
CommunicationTask
protected CommunicationTask(AerisRequest request)
-
-
Method Detail
-
executeSyncTask
public T executeSyncTask()
Execute the task in a non-thead environment. Useful if you want to execute the task within an intent service or other mechanism where you would like to wait for a response before continuing.- Returns:
- T
-
onPreExecute
protected void onPreExecute()
-
onPostExecute
protected void onPostExecute(T result)
-
unknownError
protected AerisResponse unknownError()
Message failed to do another reason not including IOException on the network.- Returns:
- The AerisResponse obj
-
unknownBatchError
protected AerisBatchResponse unknownBatchError()
Message failed to do another reason not including IOException on the network.- Returns:
- The AerisBatchResponse obj
-
onCancelled
protected void onCancelled()
-
withProgress
public CommunicationTask<T> withProgress(AerisProgressListener progressListener)
Creates the task with a progress listener. The task will tell the listener toshow progress while the task is executing and to stop when the task is done.- Parameters:
progressListener
- - Progress listener to use.- Returns:
- The task
-
isOnline
public static boolean isOnline(android.content.Context context)
Checks to see whether or not we have an established connection.- Parameters:
context
- Context obj- Returns:
- true if connected
-
-