public class Client<T extends User>
This class is an implementation of a com.kinvey.java.AbstractClient with default settings for the Android operating system.
Functionality is provided through a series of factory methods, which return the various API service wrappers.
These factory methods are all synchronized, and access is thread-safe. Once a service API has been retrieved,
it can be used to instantiate and execute asynchronous service calls. The class Client.Builder
is not thread-safe.
The calling class can pass in a callback instance. Upon completion of the service call-- either success or failure will
be invoked. The Callback mechanism is null-safe, so null
can be passed if no callbacks are required.
All callback methods are null-safe, the callback will be ignored if null
is passed in.
class Client.Builder
Modifier and Type | Class and Description |
---|---|
static class |
Client.Builder<T extends User>
Create a client for interacting with Kinvey's services from an Android Activity.
|
static class |
Client.Companion |
Modifier and Type | Field and Description |
---|---|
static Client.Companion |
Companion |
static java.lang.String |
TAG
global TAG used in Android logging
|
Constructor and Description |
---|
Client(com.google.api.client.http.HttpTransport transport,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer,
java.lang.String rootUrl,
java.lang.String servicePath,
com.google.api.client.json.JsonObjectParser objectParser,
com.kinvey.java.core.KinveyClientRequestInitializer kinveyRequestInitializer,
com.kinvey.java.auth.CredentialStore store,
com.google.api.client.http.BackOffPolicy requestPolicy,
byte[] encryptionKey,
android.content.Context context)
This class is an implementation of a com.kinvey.java.AbstractClient with default settings for the Android operating
system.
|
Modifier and Type | Method and Description |
---|---|
<I extends GenericJson,O> |
customEndpoints()
Deprecated.
|
<I extends GenericJson,O> |
customEndpoints(java.lang.Class<O> myClass)
Custom Endpoints factory method
|
T |
getActiveUser() |
long |
getBatchRate() |
int |
getBatchSize() |
com.kinvey.java.cache.ICacheManager |
getCacheManager() |
com.kinvey.java.auth.ClientUser |
getClientUser() |
android.content.Context |
getContext()
Get a reference to the Application Context used to create this instance of the Client
|
java.lang.String |
getDeviceId() |
java.lang.String |
getFileCacheFolder() |
FileStore |
getFileStore(com.kinvey.java.store.StoreType storeType) |
static KinveyHandlerThread |
getKinveyHandlerThread() |
int |
getNumberThreadPool() |
java.lang.Class<?> |
getPushServiceClass() |
com.kinvey.java.cache.ICacheManager |
getSyncCacheManager() |
long |
getSyncRate()
How long, in milliseconds, should offline wait before retrying a failed request
|
T |
getUser() |
com.kinvey.java.cache.ICacheManager |
getUserCacheManager() |
boolean |
isClientRequestMultithreading() |
void |
performLockDown() |
void |
ping(KinveyPingCallback callback)
Asynchronous Ping service method
|
AbstractPush |
push(java.lang.Class<?> pushServiceClass)
Push factory method
|
void |
setActiveUser(T value) |
void |
setCacheManager(com.kinvey.java.cache.ICacheManager p) |
void |
setClientUser(com.kinvey.java.auth.ClientUser p) |
void |
setContext(android.content.Context p)
Get a reference to the Application Context used to create this instance of the Client
|
void |
setFileCacheFolder(java.lang.String p) |
static void |
setKinveyHandlerThread(KinveyHandlerThread p) |
void |
setPushServiceClass(java.lang.Class<?> p) |
void |
setSyncCacheManager(com.kinvey.java.cache.ICacheManager p) |
void |
setUser(T p) |
void |
setUserCacheManager(com.kinvey.java.cache.ICacheManager p) |
static Client<com.kinvey.android.model.User> |
sharedInstance() |
void |
stopKinveyHandlerThread()
Terminates KinveyHandlerThread.
Should be called if the Client instance is not used anymore to prevent from memory leaks.
Currently this method is called from Instrumented tests, since each test has its own Client instance.
|
AsyncUserDiscovery |
userDiscovery()
UserDiscovery factory method
|
AsyncUserGroup |
userGroup()
UserGroup factory method
|
public static java.lang.String TAG
global TAG used in Android logging
public static Client.Companion Companion
public Client(com.google.api.client.http.HttpTransport transport, com.google.api.client.http.HttpRequestInitializer httpRequestInitializer, java.lang.String rootUrl, java.lang.String servicePath, com.google.api.client.json.JsonObjectParser objectParser, com.kinvey.java.core.KinveyClientRequestInitializer kinveyRequestInitializer, com.kinvey.java.auth.CredentialStore store, com.google.api.client.http.BackOffPolicy requestPolicy, byte[] encryptionKey, android.content.Context context)
This class is an implementation of a com.kinvey.java.AbstractClient with default settings for the Android operating system.
Functionality is provided through a series of factory methods, which return the various API service wrappers.
These factory methods are all synchronized, and access is thread-safe. Once a service API has been retrieved,
it can be used to instantiate and execute asynchronous service calls. The class Client.Builder
is not thread-safe.
The calling class can pass in a callback instance. Upon completion of the service call-- either success or failure will
be invoked. The Callback mechanism is null-safe, so null
can be passed if no callbacks are required.
All callback methods are null-safe, the callback will be ignored if null
is passed in.
class Client.Builder
public android.content.Context getContext()
Get a reference to the Application Context used to create this instance of the Client
null
or the live Application Contextpublic void setContext(android.content.Context p)
Get a reference to the Application Context used to create this instance of the Client
public com.kinvey.java.auth.ClientUser getClientUser()
public void setClientUser(com.kinvey.java.auth.ClientUser p)
public long getSyncRate()
How long, in milliseconds, should offline wait before retrying a failed request
public long getBatchRate()
public int getNumberThreadPool()
public int getBatchSize()
public boolean isClientRequestMultithreading()
public com.kinvey.java.cache.ICacheManager getCacheManager()
public void setCacheManager(com.kinvey.java.cache.ICacheManager p)
public java.lang.Class<?> getPushServiceClass()
public void setPushServiceClass(java.lang.Class<?> p)
public T getActiveUser()
public void setActiveUser(T value)
public com.kinvey.java.cache.ICacheManager getUserCacheManager()
public void setUserCacheManager(com.kinvey.java.cache.ICacheManager p)
public com.kinvey.java.cache.ICacheManager getSyncCacheManager()
public void setSyncCacheManager(com.kinvey.java.cache.ICacheManager p)
public T getUser()
public void setUser(T p)
public java.lang.String getDeviceId()
public java.lang.String getFileCacheFolder()
public void setFileCacheFolder(java.lang.String p)
public FileStore getFileStore(com.kinvey.java.store.StoreType storeType)
public void performLockDown()
public <I extends GenericJson,O> AsyncCustomEndpoints<I,O> customEndpoints()
Custom Endpoints factory method
Returns the instance of com.kinvey.java.CustomEndpoints used for executing RPC requests. Only one instance of Custom Endpoints is created for each instance of the Kinvey Client.
This method is thread-safe.
Sample Usage:
public <I extends GenericJson,O> AsyncCustomEndpoints<I,O> customEndpoints(java.lang.Class<O> myClass)
Custom Endpoints factory method
Returns the instance of com.kinvey.java.CustomEndpoints used for executing RPC requests. Only one instance of Custom Endpoints is created for each instance of the Kinvey Client.
This method is thread-safe.
Sample Usage:
public AsyncUserDiscovery userDiscovery()
UserDiscovery factory method
Returns the instance of com.kinvey.java.UserDiscovery used for searching for users. Only one instance of UserDiscovery is created for each instance of the Kinvey Client.
This method is thread-safe.
Sample Usage:
public AsyncUserGroup userGroup()
UserGroup factory method
Returns the instance of com.kinvey.java.UserGroup used for managing user groups. Only one instance of UserGroup is created for each instance of the Kinvey Client.
This method is thread-safe.
Sample Usage:
public AbstractPush push(java.lang.Class<?> pushServiceClass)
Push factory method
Returns the instance of class AbstractPush
used for configuring Push. Only one instance of
class AbstractPush
is created for each instance of the Kinvey Client.
This method is thread-safe.
Sample Usage:
pushServiceClass
- Service class for handling push notificationclass AbstractPush
for the defined collectionclass AbstractPush
,
class AbstractPush
public void ping(KinveyPingCallback callback)
Asynchronous Ping service method
Performs an authenticated ping against the configured Kinvey backend.
Sample Usage:
callback
- object of type interface KinveyPingCallback
to be notified when request completespublic void stopKinveyHandlerThread()
Terminates KinveyHandlerThread. Should be called if the Client instance is not used anymore to prevent from memory leaks. Currently this method is called from Instrumented tests, since each test has its own Client instance.
public static KinveyHandlerThread getKinveyHandlerThread()
public static void setKinveyHandlerThread(KinveyHandlerThread p)
public static Client<com.kinvey.android.model.User> sharedInstance()