Skip to content

Adding a Geo Category

This API creates a geo category. A geo category is a logical grouping of geo points. Category name may contain the following literals: a-z, A-Z, numbers 0-9 and the underscore (_ ) character. The name must start with a literal. Category names can be inspected using Backendless Console (see the image below) or using the API call retrieving a list of categories.

Adding Categories in Console

Backendless Console supports adding a category via the graphical interface. To create a category:

  1. Login to Backendless Console and select your app/backend.
  2. Click the Geolocation icon in the menu on the left.
  3. Use the "plus" icon located above the section containing the list of categories:
    create-new-geo-cat

  4. Enter the category name in the popup and click "Save".


Adding Categories with the API

Blocking API

public GeoCategory Backedless.Geo.addCategory( String categoryName ) throws BackendlessException

Non-Blocking API

public void Backedless.Geo.addCategory( String categoryName, AsyncCallback<GeoCategory> responder )

where:

Argument                Description
categoryName name of the category to create.
responder a responder object which receives a callback when the method successfully creates the category or if an error occurs. Applies to the asynchronous methods only.

Return Value

An instance of GeoCategory representing the new category. The object contains properties with category's objectId, name and number of geo points in it:

Example

Backendless.Geo.addCategory( "mycategory", new AsyncCallback<GeoCategory>()
{
  @Override
  public void handleResponse( GeoCategory category )
  {
  }

  @Override
  public void handleFault( BackendlessFault backendlessFault )
  {

  }
}