public class AccountManager extends Consts
For example, to get an Authentication Token
1. Using emailId and password, call getEloAccessToken.
2. Using clientId and secretKey, call getEloOAuthToken.
Upon successful authentication, these methods will return a token.
3. For the offline JWT token, please contact Elo support team.
The token retrieved from the server/support team is verified using the method verifyEloToken.
Unregister the broadcast receivers used by this AccountManager APIs, using the method unregisterAccountManagerListener in the onPause
and onDestroy methods of the activities in which you use these APIs to avoid leaks.
| Modifier and Type | Field and Description |
|---|---|
static int |
ACCESS_TOKEN_INVALID
Obtaining an Elo access token was not successful.
|
static int |
ACCESS_TOKEN_VALID
An access token was requested and a valid token was received from the elo servers
|
static int |
API_ACCESS_TOKEN_INVALID |
static int |
API_ACCESS_TOKEN_VALID |
static AccountManager |
instance |
static int |
IS_USER_LOGIN_OAUTH
LOGOUT the user with oauth.
|
static boolean |
isPolaris |
static int |
OAUTH_TOKEN_INVALID
Obtaining an Elo OAuth token was not successful.
|
static int |
OAUTH_TOKEN_VALID
An oAuth token was requested and a valid token was received from the elo servers
|
static int |
REQUEST_AUTH_LOGIN |
static int |
REQUEST_AUTH_LOGOUT |
static int |
SETUP_OAUTH_ERROR |
static int |
SETUP_OAUTH_SUCCESS
LOGOUT the user with oauth.
|
static int |
TOKEN_VERIFY_FAIL
A token was provided to elo server for verification and the token could not be verified.
|
static int |
TOKEN_VERIFY_SUCCESS
A token was provided to elo server for verification and was successfully verified
|
GENERIC_ERROR, OAUTH_PATH_TOKEN, OAUTH_PATH_VERIFY| Constructor and Description |
|---|
AccountManager() |
| Modifier and Type | Method and Description |
|---|---|
void |
configureOAuthHostedUI(android.app.Activity activity,
android.os.Handler handler)
This method is used to initialize OAuth Hosted UI
|
void |
destroyOAuth()
Call destroyOAuth in onStop override method of activity
|
static android.net.Uri |
getBaseUri() |
static java.lang.String |
getClientId() |
void |
getEloAccessToken(android.content.Context context,
java.lang.String userEmail,
java.lang.String password,
android.os.Handler handler)
This method is used to get an accessToken from the ELO Server.
|
void |
getEloOAuthToken(android.content.Context context,
java.lang.String clientID,
java.lang.String secret,
android.os.Handler handler)
This method is used to ask EloView Portal for a new oAuth Token.
|
java.lang.String |
getEnvironment(android.content.Context ctx) |
static java.lang.String |
getProperty() |
boolean |
isPolaris(android.content.Context context) |
boolean |
isPolarisLocked(android.content.Context context) |
void |
logoutOAuth()
logoutOAuth to end current login session
|
void |
onOAuthActivityResult(android.content.Context context,
android.content.Intent intent,
android.os.Handler handler)
Caller activity need to return onActivity result data when
requestCode -> AccountManager.REQUEST_AUTH_LOGIN and resultCode -> Activity.RESULT_OK
|
void |
selectEnvironment(android.content.Context ctx,
java.lang.String prop,
boolean isSealed) |
void |
setDefaultEnvironment(android.content.Context ctx) |
void |
setProperty(java.lang.String property) |
void |
stopOAuth()
Call stopOAuth in onStop override method of activity
|
void |
unregisterAccountManagerListener(android.content.Context context)
This method is used to unregister the broadcast receiver registered while using any of the AccountManager APIs.
Please make sure to call this in the "onPause" and "onDestroy" methods in your activity Lifecycle if you made use of any of the AccountManager APIs. |
void |
verifyEloToken(android.content.Context context,
java.lang.String accessToken,
android.os.Handler handler)
This function asks the Elo Server to verify the given token.
|
clone, getEloIntentWithFlag, getMigrate, isDevice7Inch, isDeviceM100public static final int API_ACCESS_TOKEN_VALID
public static final int API_ACCESS_TOKEN_INVALID
public static final int ACCESS_TOKEN_VALID
public static final int TOKEN_VERIFY_SUCCESS
public static final int OAUTH_TOKEN_VALID
public static final int OAUTH_TOKEN_INVALID
public static final int TOKEN_VERIFY_FAIL
public static final int ACCESS_TOKEN_INVALID
public static final int IS_USER_LOGIN_OAUTH
public static final int SETUP_OAUTH_SUCCESS
public static final int SETUP_OAUTH_ERROR
public static final int REQUEST_AUTH_LOGIN
public static final int REQUEST_AUTH_LOGOUT
public static final AccountManager instance
public static boolean isPolaris
public static java.lang.String getProperty()
public void setProperty(java.lang.String property)
public static java.lang.String getClientId()
public static android.net.Uri getBaseUri()
public void getEloAccessToken(android.content.Context context,
java.lang.String userEmail,
java.lang.String password,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).userEmail - Elo Account email addresspassword - Elo Account passwordhandler - A handler to receive one of the following callback messages:
ACCESS_TOKEN_VALID
Consts.GENERIC_ERROR
ACCESS_TOKEN_INVALID
public void configureOAuthHostedUI(android.app.Activity activity,
android.os.Handler handler)
activity - An activity instance of the calling Class (Activity/Service).handler - A handler to receive one of the following callback messages:
SETUP_OAUTH_SUCCESS
SETUP_OAUTH_ERROR
public void stopOAuth()
public void destroyOAuth()
public void logoutOAuth()
public void verifyEloToken(android.content.Context context,
java.lang.String accessToken,
android.os.Handler handler)
TOKEN_VERIFY_SUCCESS. Upon failure TOKEN_VERIFY_FAIL will be
received.context - A context object of the calling Class (Activity/Service).accessToken - access/oAuth token received from elo serverhandler - A handler to receive one of the following callback messages: TOKEN_VERIFY_FAIL
TOKEN_VERIFY_SUCCESS
public void getEloOAuthToken(android.content.Context context,
java.lang.String clientID,
java.lang.String secret,
android.os.Handler handler)
TOKEN_VERIFY_FAIL response. The same is true if a token was never procured/received. If successful, the handler will receive a message of type OAUTH_TOKEN_VALID with a JWT Token
as the response.
Below is an example of a successful response:
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlJQTSJ9.eyJ1ZW1haWwiOiJwcmF0YXBlbG8rUHJvZEBnbWFpbC5jb20iLCJvdGl0bGUiOiJwcmF0YXBlbG8rUHJvZEBnbWFpbC5jb20iLCJjYXAiOnsiY3JjIjoiSDIvb2RnIiwicGVybSI6ImZmZmZmZmYwMCJ9LCJpYXQiOjE1MjUxMTc4NDgsIm5iZiI6MTUyNTExNzg0OCwiZXhwIjoxNTI1MjA0MjQ4LCJpc3MiOiIxNTAyIiwic3ViIjoiZWVhNDRkY2JkMjU5YzQyOWY4NTA3YWZhNTQyY2Q3M2YiLCJqdGkiOiJ2ZE14N1ppUGVnWT0ifQ.b2e-F1mVh0ummkBJk3m8pT2qSCceRxuS_A9GAKtYBeo"
In case of an authentication failure due to bad clientID/secretID, the Handler will receive a
message of type OAUTH_TOKEN_INVALID.
context - A context object of the calling Class (Activity/Service).clientID - A clientID generated from the eloView portal at manage.eloview.comsecret - A secret generated from the eloView portal at manage.eloview.comhandler - A handler to receive one of the following callback messages: public void unregisterAccountManagerListener(android.content.Context context)
context - Context in which the system APIs were usedpublic void setDefaultEnvironment(android.content.Context ctx)
public void selectEnvironment(android.content.Context ctx,
java.lang.String prop,
boolean isSealed)
public boolean isPolarisLocked(android.content.Context context)
public java.lang.String getEnvironment(android.content.Context ctx)
public boolean isPolaris(android.content.Context context)
public void onOAuthActivityResult(android.content.Context context,
android.content.Intent intent,
android.os.Handler handler)
context - A context object of the calling Class (Activity/Service).intent - Intenthandler - A handler to receive one of the following callback messages:
Consts.GENERIC_ERROR
ACCESS_TOKEN_VALID
ACCESS_TOKEN_INVALID