public final class ParseCloud extends Object
ParseCloud.callFunctionInBackground(String, Map, FunctionCallback)
using a FunctionCallback
. For example, this sample code calls the "validateGame" Cloud
Function and calls processResponse if the call succeeded and handleError if it failed.
ParseCloud.callFunctionInBackground("validateGame", parameters, new FunctionCallbackUsing the callback methods is usually preferred because the network operation will not block the calling thread. However, in some cases it may be easier to use the
ParseCloud.callFunction(String, Map)
call which do block the calling thread. For example, if your
application has already spawned a background task to perform work, that background task could use
the blocking calls and avoid the code complexity of callbacks.Modifier and Type | Method and Description |
---|---|
static <T> T |
callFunction(String name,
Map<String,?> params)
Calls a cloud function.
|
static <T> Task<T> |
callFunctionInBackground(String name,
Map<String,?> params)
Calls a cloud function in the background.
|
static <T> void |
callFunctionInBackground(String name,
Map<String,?> params,
FunctionCallback<T> callback)
Calls a cloud function in the background.
|
public static <T> Task<T> callFunctionInBackground(String name, Map<String,?> params)
name
- The cloud function to call.params
- The parameters to send to the cloud function. This map can contain anything that could
be placed in a ParseObject except for ParseObjects themselves.public static <T> T callFunction(String name, Map<String,?> params) throws ParseException
name
- The cloud function to call.params
- The parameters to send to the cloud function. This map can contain anything that could
be placed in a ParseObject except for ParseObjects themselves.String
, ?>,
ParseObject
, List
<?>, or any type that can be set as a field in a
ParseObject.ParseException
public static <T> void callFunctionInBackground(String name, Map<String,?> params, FunctionCallback<T> callback)
name
- The cloud function to call.params
- The parameters to send to the cloud function. This map can contain anything that could
be placed in a ParseObject except for ParseObjects themselves.callback
- The callback that will be called when the cloud function has returned.