java.lang.Object | ||||
↳ | com.kinvey.java.core.AbstractKinveyClient.Builder | |||
↳ | com.kinvey.java.core.AbstractKinveyJsonClient.Builder | |||
↳ | com.kinvey.java.AbstractClient.Builder | |||
↳ | com.kinvey.android.Client.Builder |
Create a client for interacting with Kinvey's services from an Android Activity.
Client myClient = new Client.Builder(appKey, appSecret, getContext()).build();
All features of the library are be accessed through an instance of a client. It is recommended to maintain a single instance of aClient
while developing with Kinvey, either in an Activity, a Service, or an Application. This Builder class is not thread-safe.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Client.Builder(String appKey, String appSecret, Context context)
Use this constructor to create a AbstractClient.Builder, which can be used to build a Kinvey AbstractClient with defaults
set for the Android Operating System.
| |||||||||||
Client.Builder(Context context)
Use this constructor to create a Client.Builder, which can be used to build a Kinvey Client with defaults
set for the Android Operating System.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Client | build() | ||||||||||
void |
build(KinveyClientBuilderCallback buildCallback)
Asynchronous Client build method
| ||||||||||
Client.Builder |
enableGCM(boolean gcmEnabled)
Builder method to enable GCM for the client
| ||||||||||
Client.Builder |
setCredentialStore(CredentialStore store)
Define how credentials will be stored
| ||||||||||
Client.Builder | setGcmInProduction(boolean inProduction) | ||||||||||
Client.Builder |
setRetrieveUserCallback(KinveyUserCallback callback)
Sets a callback to be called after a client is intialized and User attributes is being retrieved.
| ||||||||||
Client.Builder |
setSenderIDs(String senderID)
Builder method to set sender ID for GCM push
| ||||||||||
Client.Builder | setUserClass(Class userClass) |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Use this constructor to create a AbstractClient.Builder, which can be used to build a Kinvey AbstractClient with defaults set for the Android Operating System.
This constructor does NOT support push notification functionality. If push notifications are necessary, use a properties file and the overloaded constructor.
appKey | Your Kinvey Application Key |
---|---|
appSecret | Your Kinvey Application Secret |
context | Your Android Application Context |
Use this constructor to create a Client.Builder, which can be used to build a Kinvey Client with defaults set for the Android Operating System.
This constructor requires a properties file, containing configuration for your Kinvey Client. Save this file within your Android project, at: assets/kinvey.properties
This constructor provides support for push notifications.
Kinvey Guide for initializing Client with a properties file.
context | - Your Android Application Context |
---|
Asynchronous Client build method
buildCallback | Instance of {@link: KinveyClientBuilderCallback} |
---|
Builder method to enable GCM for the client
gcmEnabled | - should push use GCM, defaults to true |
---|
Define how credentials will be stored
store | something implpemting CredentialStore interface |
---|
Sets a callback to be called after a client is intialized and User attributes is being retrieved.
When a client is intialized after an initial login, the user's credentials are cached locally and used for the initialization of the client. As part of the initialization process, a background thread is spawned to retrieve up-to-date user attributes. This optional callback is called when the retrieval process is complete and passes an instance of the logged in user.
Sample Usage:
Client myClient = Client.Builder(this)
.setRetrieveUserCallback(new KinveyUserCallback() {
public void onFailure(Throwable t) {
CharSequence text = "Error retrieving user attributes.";
Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT).show();
public void onSuccess(User u) {
CharSequence text = "Retrieved up-to-date data for " + u.getUserName() + ".";
Toast.makeText(getApplicationContext(), text, Toast.LENGTH_SHORT).show();
}
}).build();
}
>Builder method to set sender ID for GCM push
senderID | - the senderID to register |
---|