public class Session extends Object implements Context
Session holds transient data applicable to a user session. It also
has a key-value pair based data-store which SDK users can use to store
session related data.
There is an EventBus instance which Session contains. The
event bus is kept inside session so as to allow multiple user sessions within
SDK. Currently SDK support a SINGLE use session.
| Modifier and Type | Field and Description |
|---|---|
static String |
KEY_DEVICE_TYPE
Datastore key for deviceType; session stores underlying device type
|
static String |
KEY_DOMAIN
Datastore key for domain (domain in
JID) |
static String |
KEY_IS_SM_SUPPORTED
Datastore key for setting isSMSupported
|
static String |
KEY_MAX_RESUMPTION_TIME_IN_SEC
Datastore key for max resumption time; resumption time is stored in
seconds
|
static String |
KEY_MUC_SERVICE
Datastore key for MUC service
|
static String |
KEY_USER_JID
Datastore key for user
JID |
static String |
KEY_USER_NAME
Datastore key for username
|
static String |
KEY_USER_PASSWORD
Datastore key for user password
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroys this context after which the context will become unusable.
|
Object |
get(Object key)
Returns value associated with this key
|
Calendar |
getCreateTime() |
EventBus |
getEventBus() |
void |
invalidate() |
boolean |
isAuthenticated()
Check if the session has been authnticated.
|
Object |
put(Object key,
Object val)
Store a value associated with given key.
|
void |
reset()
Resets
Context. |
void |
setAuthenticated(boolean authenticated) |
public static final String KEY_USER_NAME
public static final String KEY_USER_JID
JIDpublic static final String KEY_USER_PASSWORD
public static final String KEY_DOMAIN
JID)public static final String KEY_MUC_SERVICE
public static final String KEY_DEVICE_TYPE
public static final String KEY_IS_SM_SUPPORTED
public static final String KEY_MAX_RESUMPTION_TIME_IN_SEC
public Session()
public Session(EventBus eventBus)
public Object get(Object key)
DataHolderget in interface DataHolderkey - key for which value will be returnedpublic Object put(Object key, Object val)
DataHolderput in interface DataHolderkey - keyval - valuepublic EventBus getEventBus()
getEventBus in interface ContextEventBus instance from the Contextpublic Calendar getCreateTime()
public void reset()
ContextContext. Resetting Context will flush all the data held by
{code Context}. However it will not change the create time of the
context.public boolean isAuthenticated()
public void setAuthenticated(boolean authenticated)
public void invalidate()
Copyright © 2019. All rights reserved.