public class

Client

extends AbstractClient
java.lang.Object
   ↳ com.kinvey.java.core.AbstractKinveyClient
     ↳ com.kinvey.java.core.AbstractKinveyJsonClient
       ↳ com.kinvey.java.AbstractClient
         ↳ com.kinvey.android.Client

Class Overview

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 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.

Summary

Nested Classes
class Client.Builder Create a client for interacting with Kinvey's services from an Android Activity. 
Constants
String TAG global TAG used in Android logging
[Expand]
Inherited Constants
From class com.kinvey.java.AbstractClient
Public Methods
<T> AsyncAppData<T> appData(String collectionName, Class<T> myClass)
AppData factory method

Returns an instance of com.kinvey.java.AppData for the supplied collection.

AsyncCustomEndpoints customEndpoints()
Custom Endpoints factory method

Returns the instance of com.kinvey.java.CustomEndpoints used for executing RPC requests.

AsyncFile file()
File factory method

Returns an instance of com.kinvey.java.File for uploading and downloading of files.

Context getContext()
Get a reference to the Application Context used to create this instance of the Client
<T extends LinkedGenericJson> AsyncLinkedData<T> linkedData(String collectionName, Class<T> myClass)
LinkedData factory method

Returns an instance of AsyncLinkedData for the supplied collection.

<T> OfflineAppData<T> offlineAppData(String collectionName, Class<T> myClass)
OfflineAppData factory method

Returns an instance of OfflineAppData for the supplied collection.

void ping(KinveyPingCallback callback)
Asynchronous Ping service method

Performs an authenticated ping against the configured Kinvey backend.

AbstractPush push()
Push factory method

Returns the instance of AbstractPush used for configuring Push.

void setContext(Context context)

Setter for the field context.

AsyncUser user()
User factory method

Returns the instance of com.kinvey.java.User that contains the current active user.

AsyncUserDiscovery userDiscovery()
UserDiscovery factory method

Returns the instance of com.kinvey.java.UserDiscovery used for searching for users.

AsyncUserGroup userGroup()
UserGroup factory method

Returns the instance of com.kinvey.java.UserGroup used for managing user groups.

[Expand]
Inherited Methods
From class com.kinvey.java.AbstractClient
From class com.kinvey.java.core.AbstractKinveyJsonClient
From class com.kinvey.java.core.AbstractKinveyClient
From class java.lang.Object

Constants

public static final String TAG

global TAG used in Android logging

Constant Value: "Kinvey - Client"

Public Methods

public AsyncAppData<T> appData (String collectionName, Class<T> myClass)

AppData factory method

Returns an instance of com.kinvey.java.AppData for the supplied collection. A new instance is created for each collection, but only one instance of AsyncAppData is created per collection. The method is Generic and takes an instance of a com.google.api.client.json.GenericJson entity type that is used for fetching/saving of com.kinvey.java.AppData.

This method is thread-safe.

Sample Usage:

 AppData<myEntity> myAppData = kinveyClient.appData("entityCollection", myEntity.class);
     
 

Parameters
collectionName The name of the collection
myClass The class that defines the entity of type com.google.api.client.json.GenericJson used for saving and fetching of data
Returns
  • Instance of com.kinvey.java.AppData for the defined collection

public AsyncCustomEndpoints 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:

     CustomEndpoints myCustomEndpoints = kinveyClient.customEndpoints();
     
 

Returns
  • Instance of com.kinvey.java.UserDiscovery for the defined collection

public AsyncFile file ()

File factory method

Returns an instance of com.kinvey.java.File for uploading and downloading of files. Only one instance is created for each instance of the Kinvey client.

This method is thread-safe.

Sample Usage:

 File myFile = kinveyClient.file();
     
 

Returns
  • Instance of com.kinvey.java.File for the defined collection

public Context getContext ()

Get a reference to the Application Context used to create this instance of the Client

Returns
  • null or the live Application Context

public AsyncLinkedData<T> linkedData (String collectionName, Class<T> myClass)

LinkedData factory method

Returns an instance of AsyncLinkedData for the supplied collection. A new instance is created for each collection, but only one instance of LinkedData is created per collection. The method is Generic and takes an instance of a LinkedGenericJson entity type that is used for fetching/saving of AsyncLinkedData.

This method is thread-safe.

Sample Usage:

 LinkedData<myEntity> myAppData = kinveyClient.linkedData("entityCollection", myEntity.class);
    
 

Parameters
collectionName The name of the collection
myClass The class that defines the entity of type LinkedGenericJson used for saving and fetching of data
Returns

public OfflineAppData<T> offlineAppData (String collectionName, Class<T> myClass)

OfflineAppData factory method

Returns an instance of OfflineAppData for the supplied collection. A new instance is created for each collection, but only one instance of OfflineAppData is created per collection. The method is Generic and takes an instance of a com.google.api.client.json.GenericJson entity type that is used for fetching/saving of OfflineAppData.

This method is thread-safe.

Sample Usage:

     OfflineAppData<myEntity> myAppData = kinveyClient.offlineAppData("entityCollection", myEntity.class);
     
 

Parameters
collectionName The name of the collection
myClass The class that defines the entity of type com.google.api.client.json.GenericJson used for saving and fetching of data
Returns

public void ping (KinveyPingCallback callback)

Asynchronous Ping service method

Performs an authenticated ping against the configured Kinvey backend. This method must be executed in the context of a logged-in active user.

Sample Usage:

     kinveyClient.ping(new KinveyPingCallback() {
            onSuccess(Boolean result) { ... 
            onFailure(Throwable error) { ... }
        }
     }
 

Parameters
callback object of type KinveyPingCallback to be notified when request completes

public AbstractPush push ()

Push factory method

Returns the instance of AbstractPush used for configuring Push. Only one instance of AbstractPush is created for each instance of the Kinvey Client.

This method is thread-safe.

Sample Usage:

     AbstractPush myPush = kinveyClient.push();
     
 

Returns

public void setContext (Context context)

Setter for the field context.

Parameters
context a android.content.Context object.

public AsyncUser user ()

User factory method

Returns the instance of com.kinvey.java.User that contains the current active user. If no active user context has been established, the com.kinvey.java.User object returned will be instantiated and empty.

This method is thread-safe.

Sample Usage:

 User currentUser = kinveyClient.currentUser();
     
 

Returns
  • Instance of com.kinvey.java.User for the defined collection

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:

     UserDiscovery myUserDiscovery = kinveyClient.userDiscovery();
     
 

Returns
  • Instance of com.kinvey.java.UserDiscovery for the defined collection

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:

     UserGroup myUserGroup = kinveyClient.userGroup();
     
 

Returns
  • Instance of com.kinvey.java.UserGroup for the defined collection