public class BaasBox
extends java.lang.Object
BaasBox.initDefault(android.content.Context)
before using any other part of the sdk.
It's suggested to initialize the client in the Application:
public class MyBaasBoxApp extends Application {
private BaasBox box;
@Override
public void onCreate() {
super.onCreate();
BaasBox.Builder b = new BaasBox.Builder();
//set your configuration
//on builder class
box = b.init();
}
public BaasBox getBaasBox(){
return box;
}
}
Modifier and Type | Class and Description |
---|---|
static class |
BaasBox.Builder
Builder for
BaasBox client |
static class |
BaasBox.Config
The configuration for BaasBox client
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
API_VERSION
Version of the supported server api
|
BaasBox.Config |
config
Configuration of this BaasBox client
|
static java.lang.String |
MIN_API_VERSION
Minimum supported baasbox server api
|
static java.lang.String |
SDK_VERSION
Version of the baasbox sdk.
|
Modifier and Type | Method and Description |
---|---|
<R> BaasResult<R> |
await(RequestToken requestToken) |
static BaasBox.Builder |
builder(android.content.Context context)
Returns a new BaasBox Builder
|
android.content.Context |
getContext() |
static BaasBox |
getDefault()
Returns the baasbox instance for this device if one has been
initialized through
BaasBox.initDefault(android.content.Context)
or null. |
static BaasBox |
initDefault(android.content.Context context)
Initialize BaasBox client with default configuration.
|
static BaasCloudMessagingService |
messagingService()
Returns the messaging service instance
used by baasbox.
|
static void |
quitClient() |
static Rest |
rest()
Returns the raw passthrough rest client
|
RequestToken |
rest(int method,
java.lang.String endpoint,
JsonArray body,
boolean authenticate,
BaasHandler<JsonObject> handler)
Deprecated.
|
RequestToken |
rest(int method,
java.lang.String endpoint,
JsonArray body,
int flags,
boolean authenticate,
BaasHandler<JsonObject> jsonHandler)
Deprecated.
|
RequestToken |
rest(int method,
java.lang.String endpoint,
JsonObject body,
boolean authenticate,
BaasHandler<JsonObject> handler)
Deprecated.
|
RequestToken |
rest(int method,
java.lang.String endpoint,
JsonObject body,
int flags,
boolean authenticate,
BaasHandler<JsonObject> jsonHandler)
Deprecated.
|
BaasResult<JsonObject> |
restSync(int method,
java.lang.String endpoint,
JsonArray body,
boolean authenticate)
Deprecated.
|
BaasResult<JsonObject> |
restSync(int method,
java.lang.String endpoint,
JsonObject body,
boolean authenticate)
Deprecated.
|
public static final java.lang.String SDK_VERSION
public static final java.lang.String API_VERSION
public static final java.lang.String MIN_API_VERSION
public final BaasBox.Config config
public static BaasBox initDefault(android.content.Context context)
context
- cannot be null.BaasBox
clientpublic static void quitClient()
public static BaasBox getDefault()
BaasBox.initDefault(android.content.Context)
or null.public static BaasCloudMessagingService messagingService()
public static Rest rest()
public <R> BaasResult<R> await(RequestToken requestToken)
@Deprecated public RequestToken rest(int method, java.lang.String endpoint, JsonArray body, int flags, boolean authenticate, BaasHandler<JsonObject> jsonHandler)
flags
- bitmask of flags for the request Flags
method
- the method to useendpoint
- the resourcebody
- an optional json arrayJsonObject
response wrapped as BaasResult
@Deprecated public RequestToken rest(int method, java.lang.String endpoint, JsonObject body, int flags, boolean authenticate, BaasHandler<JsonObject> jsonHandler)
flags
- bitmask of flags for the request Flags
method
- the method to useendpoint
- the resourcebody
- an optional json objectJsonObject
response wrapped as BaasResult
@Deprecated public RequestToken rest(int method, java.lang.String endpoint, JsonArray body, boolean authenticate, BaasHandler<JsonObject> handler)
method
- the method to useendpoint
- the resourcebody
- an optional jsono bjectauthenticate
- true if the client should try to refresh authentication automaticallyhandler
- a callback to handle the json responseJsonObject
response wrapped as BaasResult
@Deprecated public RequestToken rest(int method, java.lang.String endpoint, JsonObject body, boolean authenticate, BaasHandler<JsonObject> handler)
method
- the method to useendpoint
- the resourcebody
- an optional jsono bjectauthenticate
- true if the client should try to refresh authentication automaticallyhandler
- a callback to handle the json responseJsonObject
response wrapped as BaasResult
@Deprecated public BaasResult<JsonObject> restSync(int method, java.lang.String endpoint, JsonArray body, boolean authenticate)
method
- the method to useendpoint
- the resourcebody
- an optional jsono bjectauthenticate
- true if the client should try to refresh authentication automaticallyJsonObject
response wrapped as BaasResult
@Deprecated public BaasResult<JsonObject> restSync(int method, java.lang.String endpoint, JsonObject body, boolean authenticate)
method
- the method to useendpoint
- the resourcebody
- an optional jsono bjectauthenticate
- true if the client should try to refresh authentication automaticallyJsonObject
response wrapped as BaasResult
public static BaasBox.Builder builder(android.content.Context context)
context
- public final android.content.Context getContext()