Skip to content

Get list of all categories

Mapmd edited this page May 13, 2019 · 2 revisions

More information about request,response and other search street

Add the INTERNET permission

To use Map query, you must add the

<uses-permission android:name="android.permission.INTERNET" />

to your app's manifest. Without this, your app won't be able to connect to the network.

Use Map Get all types of companies

Listener Exemple:

   QueryCategory queryCategory = new QueryCategory(new QueryCategory.OnCallbackResult() {

            @Override
            public void onSuccess(JsonArray result, int statusCode) {
                
            }

            @Override
            public void onFailure(Throwable throwable) {
                
            }
        });

or register listener

 queryCategory.registerOnCategoryListener( new QueryCategory.OnCallbackResult())

To get the values out of the QueryCategory, there’s a sendRequest, example:

 queryCategory.getAllCategory();

Use Get companies by category ID

   QueryCategory queryCategory = new QueryCategory(new QueryCategory.OnCallbackResultItem() {

            @Override
            public void onSuccess(JsonObject result, int statusCode) {
               
            }

            @Override
            public void onFailure(Throwable throwable) {
               
            }
        });
queryCategory.getListCompanies(id);

Cancel a request:

To cancel a request, call onCancelRequest() on your Request object. Once cancelled your response handler will never be called. What this means in practice is that you can cancel all of your pending requests in your activity's onStop() method and you don't have to litter your response handlers with checks for getActivity() == null, whether onSaveInstanceState() has been called already, or other defensive boilerplate.

To take advantage of this behavior, you would typically have to track all in-flight requests in order to be able to cancel them at the appropriate time. There is an easier way: you can associate a tag object with each request. You can then use this tag to provide a scope of requests to cancel. For example, you can tag all of your requests with the Activity they are being made on behalf of, and call querySearch.onCancelRequest from onStop(). Here is an example :

  1. Define object and add it to your requests.
QueryCategory queryCategory;  // Assume this exists.

2.In your activity's onStop() method, cancel all requests that have this object.

@Override
protected void onStop () {
    super.onStop();
    if (queryCategory != null) {
        queryCategory.onCancelRequest();
    }
}

Clone this wiki locally