HERE Android SDK Developer's Guide

Request<T>

The class Request<T> is a member of com.here.android.mpa.search .

Type Parameters:

  • T

    Data type for results

Class Summary

public abstract class Request

extends java.lang.Object

Represents a base class for a search request.

[For complete information, see the section Class Details]

Nested Class Summary

Table 1. Nested Classes in Request<T>
Nested Classes

public static final enumeration Request.Connectivity

Represents values describing possible types of connectivity that the request is performed.

Field Summary

Table 2. Fields in Request<T>
Fields

public static final String BUILDING_ID_REFERENCE_NAME

Name used to get building identifier references.

public static final String PLACE_CONTENT_WIKIPEDIA

Name used to get editorial wikipedia content in place details response.

public static final String PVID_ID_REFERENCE_NAME

Name used to get core POI identifier references.

public static final String VENUES_CONTENT_ID_REFERENCE_NAME

Name used to get only venues.content identifier references.

public static final String VENUES_DESTINATION_ID_REFERENCE_NAME

Name used to get only venues.destination identifier references.

public static final String VENUES_ID_REFERENCE_NAME

Name used to get all venues identifier references.

public static final String VENUES_VENUE_ID_REFERENCE_NAME

Name used to get only venues.venue identifier references.

protected ConnectivityMode m_connectivityMode

Method Summary

Table 3. Methods in Request<T>
Methods

public void addCustomHeader (String name, String value)

protected Request<T> addReference (String name)

This function adds the name of a requested reference identifiers to be returned in the results.

public boolean cancel ()

Cancels any pending results from an invoked request.

public ErrorCode execute (ResultListener<T> eventListener)

Executes an asynchronous request.

protected int getCollectionSize ()

Gets the current collection size being used for request responses.

public Connectivity getConnectivity ()

This function returns the connectivity of request.

protected List getReferences ()

This function returns the names of requested reference identifiers to be returned in the results.

protected Request<T> setCollectionSize (int value)

Sets a collection size to be used for request responses.

public void setConnectivity (Connectivity connectivity)

Sets the connectivity of request.

protected Request<T> setMapViewport (GeoBoundingBox mapViewport)

The map viewport is a bounding box of the map area currently visible to the user.

public Request<T> setUserAuthentication (String token)

Some requests, such as when posting images or reviews, applications must provide an OAuth 2.0 bearer token (obtained from HERE Account) to authenticate the user performing the action.

Class Details

Represents a base class for a search request.

Field Details

public static final String BUILDING_ID_REFERENCE_NAME

Name used to get building identifier references.

Use addReference(String) to be able to retrieve the building identifier from the returned PlaceLink (using getReference(String) ).

The building identifier can also be retrieved using addReference(String) and getReference(String) (or addReference(String) and getReference(String)).

See also:

addReference(String)

getReference(String)

addReference(String)

getReference(String)

public static final String PLACE_CONTENT_WIKIPEDIA

Name used to get editorial wikipedia content in place details response.

Use addContent(String) to specify PLACE_CONTENT_WIKIPEDIA content source in PlaceRequest.

See also:

getContent()

getEditorials()

EditorialMedia

public static final String PVID_ID_REFERENCE_NAME

Name used to get core POI identifier references.

Use addReference(String) to be able to retrieve the POI identifier from the returned PlaceLink (using getReference(String)).

The POI identifier can also be retrieved using addReference(String) and getReference(String) (or addReference(String) and getReference(String)).

See also:

addReference(String)

getReference(String)

addReference(String)

getReference(String)

public static final String VENUES_CONTENT_ID_REFERENCE_NAME

Name used to get only venues.content identifier references.

Use addReference(String) to be able to retrieve the venues.content identifier from the returned PlaceLink (using getReference(String) ).

The venues.content identifier can also be retrieved using addReference(String) and getReference(String) (or addReference(String) and getReference(String)).

See also:

addReference(String)

getReference(String)

addReference(String)

getReference(String)

public static final String VENUES_DESTINATION_ID_REFERENCE_NAME

Name used to get only venues.destination identifier references.

Use addReference(String) to be able to retrieve the venues.destination identifier from the returned PlaceLink (using getReference(String)).

The venues.destination identifier can also be retrieved using addReference(String) and getReference(String) (or addReference(String) and getReference(String)).

See also:

addReference(String)

getReference(String)

addReference(String)

getReference(String)

public static final String VENUES_ID_REFERENCE_NAME

Name used to get all venues identifier references.

Use addReference(String) to be able to retrieve all venues identifier from the returned PlaceLink (using getReference(String) ).

The venues identifier can also be retrieved addReference(String) and getReference(String) (or addReference(String) and getReference(String)).

This reference name can be used retrieve all the different venues identifiers, namely: VENUES_CONTENT_ID_REFERENCE_NAME, VENUES_DESTINATION_ID_REFERENCE_NAME and VENUES_VENUE_ID_REFERENCE_NAME.

See also:

addReference(String)

getReference(String)

addReference(String)

getReference(String)

public static final String VENUES_VENUE_ID_REFERENCE_NAME

Name used to get only venues.venue identifier references.

Use addReference(String) to be able to retrieve the venues.venue identifier from the returned PlaceLink (using getReference(String) ).

The venues.venue identifier can also be retrieved using addReference(String) and getReference(String) (or addReference(String) and getReference(String)).

See also:

addReference(String)

getReference(String)

addReference(String)

getReference(String)

protected ConnectivityMode m_connectivityMode

Method Details

public void addCustomHeader (String name, String value)

Parameters:

  • name
  • value

protected Request<T> addReference (String name)

This function adds the name of a requested reference identifiers to be returned in the results. For example, to retrieve an extruded building identifier, set this value to BUILDING_ID_REFERENCE_NAME .

Parameters:

  • name

    Name of reference identifier to retrieve.

Returns:

True if name added, false otherwise.

See also:

SearchRequest

ExploreRequest

HereRequest

PlaceRequest

public boolean cancel ()

Cancels any pending results from an invoked request.

Returns:

True if the request was canceled successfully, false otherwise

public ErrorCode execute (ResultListener<T> eventListener)

Executes an asynchronous request.

Parameters:

  • eventListener

    A ResultListener passed along with the request to monitor progress

Returns:

The ErrorCode representing an appropriate result

protected int getCollectionSize ()

Gets the current collection size being used for request responses.

Returns:

The current response collection size

See also:

SearchRequest

ExploreRequest

HereRequest

TextSuggestionRequest

TextAutoSuggestionRequest

GeocodeRequest

public Connectivity getConnectivity ()

This function returns the connectivity of request.

Returns:

The request connectivity.

protected List getReferences ()

This function returns the names of requested reference identifiers to be returned in the results.

Returns:

List of the names of reference identifiers to be returned in the result.

See also:

SearchRequest

ExploreRequest

HereRequest

PlaceRequest

protected Request<T> setCollectionSize (int value)

Sets a collection size to be used for request responses. The maximum number of result items in each collection will be limited to this value. The valid value range is [1..100]. The default collection size is 20.

Parameters:

  • value

    Desired response collection size size per request.

Returns:

This Request object

Throws:

  • IllegalArgumentException

    if size is out of range.

See also:

SearchRequest

ExploreRequest

HereRequest

TextSuggestionRequest

TextAutoSuggestionRequest

GeocodeRequest

public void setConnectivity (Connectivity connectivity)

Sets the connectivity of request. By default, the connectivity of request is controlled by the SDK. If the SDK is online then an online request will be made. If the SDK is offline then an offline request will be made. Be aware, OFFLINE request can return limited result details. Results from ONLINE request will provide the best information available.

Parameters:

  • connectivity

    Desired request connectivity.

protected Request<T> setMapViewport (GeoBoundingBox mapViewport)

The map viewport is a bounding box of the map area currently visible to the user. The viewport can act as an implicit location context in the absence of an explicit location context. To ensure you get the best results possible, you should always set a viewport if there is a map visible to the user.

Parameters:

  • mapViewport

    The bounding box of the map area currently visible.

See also:

SearchRequest

ExploreRequest

HereRequest

TextSuggestionRequest

TextAutoSuggestionRequest

GeocodeRequest

public Request<T> setUserAuthentication (String token)

Some requests, such as when posting images or reviews, applications must provide an OAuth 2.0 bearer token (obtained from HERE Account) to authenticate the user performing the action. The procedure for obtaining a token is outside of the scope of this documentation. Please refer to the HERE Account Single Sign On (SSO) API documentation for more information.

Parameters:

  • token

    The User authentication bearer token.