Kevin Ko Kevin Ko - 1 year ago 182
Android Question

How can Android get the multiple values from the custom API using InvokeAPI method

I'd like to get the customer search results from the custom API in the Azure Mobile Service. When I check the custome API using the Fiddler, it returns multiple search results. But my Invoke API only get the one result. How I can get the all results? My Azure-Mobile-Android SDK is 3.1.0

ListenableFuture<jsonelement> response = mClient.invokeApi("customersearch", request, JsonElement.class);

Futures.addCallback(response, new FutureCallback<jsonelement>() {
public void onSuccess(JsonElement response) {
Log.d("Debug","Response received!!! " + response.toString());


public void onFailure(Throwable throwable) {

createAndShowDialog((Exception) throwable, "Wakeup Error");


Answer Source

@KevinKo, I viewed the source code, then I found the function invokeApi return multiple entities or only one entity via the function Class.isArray() for the parameter final Class<E> clazz.

So please use JsonElement[].class instead of JsonElement.class to try again.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download