Start a new topic

what is correct way to invoke custom endpoint in Android?

The following section of the BL guide (http://devcenter.kinvey.com/android/guides/business-logic#invoking-endpoint) suggests we invoke a custom endpoint like this:



1. AsyncCustomEndpoints endpoints = getClient().customEndpoints();

2. endpoints.callEndpoint( etc... )



When I write line 1, I get the following deprecation warning: The method customEndpoints() from the type Client is deprecated



The changelog (http://devcenter.kinvey.com/android/downloads) makes no mention of this deprecation.



Can someone confirm the correct way to invoke a custom endpoint in Android?



Thanks.
1 Comment

hey that deprecated method still works, however there are variations using Generics to allow for custom GenericJson classes for input and output.



Assuming you have two GenericJson classes, on is `MyRequestClass` and one is `MyResponseClass`:



AsyncCustomEndpoints endpoints = getClient().customEndpoints(MyResponseClass.class);



Then, when it's time to invoke, call:

endpoints.callEndpoint("doit", new MyRequestClass(), new KinveyListCallback() {

@Override

public void onSuccess(MyResponseClass[] result) {

if (result == null){

results.setText("nope, got null back!");

}else{

results.setText(result[0].toString()) ;



}

}

@Override

public void onFailure(Throwable error) {

results.setText("Uh oh -> " + error);

}

});



Login or Signup to post a comment