Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Loopback custom method call from Android

In the examples below, I'll assume your model is called Greeter and the static method Greeter.greet is invoked via GET /greeters/greet?name=Alex.

First of all, you need to describe the REST mapping of your method. Then you can call the method using invokeMethod.

public class GreeterRepository extends
ModelRepository<Greeter> {
    public RestContract createContract() {
      RestContract contract =

      contract.addItem(new RestContractItem("/" +
getNameForRestUrl() + "/greet", "POST"),
                  getClassName() + ".greet");

      return contract;

    public void greet(name, final VoidCallback
callback) {
ImmutableMap.of("name", name), new
Adapter.Callback() {

            public void onError(Throwable t) {

            public void onSuccess(String response)

See and for examples of methods that parse the response body.

Disclaimer: I am one of the developers of LoopBack, loopback-sdk-android is one of my specialisations.

Categories : Android

Related to : Loopback custom method call from Android
Overriding Relation Remote Method In Strongloop Loopback
I figured out that I can juse add a new remote method the normal way. loopback.remoteMethod( UserModel.prototype.getFollows, { description: 'Get the users who are followed by the user', accepts: [ {arg: 'page', type: 'Number', http: {source: 'query'}, required: true} ], returns: {arg: 'data

Categories : Node Js
what is the difference between writing custom method and custom filters?
As far as i get by custom method you mean overriding controller pipeline methods like OnActionExecuted OnResultExecuted etc. If you implement your logic there, code which you write there will be exicuted on All controller methods. Moreover if you want to use this logic in other controllers in your application you had to create your CoreContoller class were you override methods and inherit it by ot

Categories : Asp Net Mvc
how to acess image path from onActivityResult method to AsyncTask doInBackground method in android
That's because you made path a local variable of onActivityResult(). Make it a variable of your activity. Change String path = getRealPathFromURI(.. to path = getRealPathFromURI(... And declare String path=""; in the activity.

Categories : Java and CouchDB connector
I would suggest playing with the API explorer to figure out your endpoints. Create a sample LoopBack project via slc loopback Create some models via slc loopback:model Start the app via slc run Browse to localhost:3000/explorer In there you can see all the endpoints that are automatically generated by LoopBack. Like if you click the GET endpoint for a model, it will show the query as GET /api/

Categories : Rest
custom class method returning nil Swift IOS
My understanding is that you have an api variable, which should contain an instance of API, but it's nil instead. Are you initializing it? The fact you are using optional chaining indicates that the variable is an optional, and if it's nil this statement: api?.SaveEditModel(user!) does nothing. So, double check if you are assigning an instance of API to the api variable in your code.

Categories : IOS
Recently Add
"Could not find method packageName()" Error in RC1 - Flavors do not compile
How to get estimote beacons range in Android?
android easy way to check contact has image
How to get the music player buttons on Android wear like google play music
Broken built tools in android SDK manager (missing aapt.exe )
Fragments keep duplicating
Using WRAP_CONTENT, popupwindow gets hole screen width
how i can check if DB have data and insert new rows in sqlite android
Roboguice example astroboy can't work with NullPointerException
Passively search for Bluetooth devices for location detection
Retreiving data from existing database and populate it in a listview
How to check when wearable app is installed on watches?
Travis CI - Android Project Build Failing
Can onStartCommand() get called while onDestroy() is executing?
How to set selected item of Spinner by value, not by position
Why does getActivity() work when updating a fragment?
how can I change LinearLayout's color with round corner in runtime?
ANDROID : Webview doesn't take full width
Is it possible to get another application's primary color like lollipop's recents view
No resource found that matches the given name keeps showing
how to display image on imageview dynamically from drawalble folder
Android WebView Push assign name to DeviceID
how to get all sub admin area's / districts for a country
How to integrate barcode scanner into glass app
what's the difference between TELEPHONY_SERVICE1 and TELEPHONY_SERVICE
Android: NoClassDefFoundError android.os.AsyncTask
Get Battery Standby time, 2G/3G Usage in Android
How to get data from SOAP response in android?
How to know a process of an app is 32-bit or 64-bit programmatically in Android lollipop?
two .so files couldn't load from two different package in an application why?
© Copyright 2017 Publishing Limited. All rights reserved.