Package com.clover.sdk.util
Class AuthTask
- java.lang.Object
-
- android.os.AsyncTask<Account,Void,CloverAuth.AuthResult>
-
- com.clover.sdk.util.AuthTask
-
public class AuthTask extends AsyncTask<Account,Void,CloverAuth.AuthResult>
Authenticates with the Clover service in the background. Subclasses can override callback methods in order to respond to success or failure.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class android.os.AsyncTask
AsyncTask.Status
-
-
Field Summary
-
Fields inherited from class android.os.AsyncTask
SERIAL_EXECUTOR, THREAD_POOL_EXECUTOR
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CloverAuth.AuthResult
doInBackground(Account... accounts)
String
getErrorMessage()
Return the error message that was generated when authentication failed, ornull
if authentication succeeded.Exception
getException()
Return theException
that was thrown when authentication failed, ornull
if authentication succeeded.protected void
onAuthCanceled(OperationCanceledException e)
Called on the main thread ifOperationCanceledException
was thrown during authentication.protected void
onAuthComplete(boolean success, CloverAuth.AuthResult result)
Called on the main thread after the auth process has completed.protected void
onAuthenticatorException(AuthenticatorException e)
Called on the main thread ifAuthenticatorException
was thrown during authentication.protected void
onIOException(IOException e)
Called on the main thread ifIOException
was thrown during authentication.protected void
onPostExecute(CloverAuth.AuthResult result)
Calls callback methods after the authentication attempt completes.-
Methods inherited from class android.os.AsyncTask
cancel, execute, execute, executeOnExecutor, get, get, getStatus, isCancelled, onCancelled, onCancelled, onPreExecute, onProgressUpdate, publishProgress
-
-
-
-
Constructor Detail
-
AuthTask
public AuthTask(Activity activity)
Create a newAuthTask
.- Parameters:
activity
- theActivity
that initiated authentication with the Clover service.
-
-
Method Detail
-
getException
public Exception getException()
Return theException
that was thrown when authentication failed, ornull
if authentication succeeded.
-
getErrorMessage
public String getErrorMessage()
Return the error message that was generated when authentication failed, ornull
if authentication succeeded.
-
doInBackground
protected CloverAuth.AuthResult doInBackground(Account... accounts)
- Specified by:
doInBackground
in classAsyncTask<Account,Void,CloverAuth.AuthResult>
-
onPostExecute
protected void onPostExecute(CloverAuth.AuthResult result)
Calls callback methods after the authentication attempt completes. If a subclass overrides this method, it should call the parent implementation. Otherwise the callback methods will not be called.- Overrides:
onPostExecute
in classAsyncTask<Account,Void,CloverAuth.AuthResult>
-
onAuthComplete
protected void onAuthComplete(boolean success, CloverAuth.AuthResult result)
Called on the main thread after the auth process has completed.- Parameters:
success
-true
if authentication was successfulresult
- the authentication result, ornull
if an exception was thrown
-
onAuthCanceled
protected void onAuthCanceled(OperationCanceledException e)
Called on the main thread ifOperationCanceledException
was thrown during authentication.
-
onAuthenticatorException
protected void onAuthenticatorException(AuthenticatorException e)
Called on the main thread ifAuthenticatorException
was thrown during authentication.
-
onIOException
protected void onIOException(IOException e)
Called on the main thread ifIOException
was thrown during authentication.
-
-