What's Nearby Category
This example demonstrates how to search for points of interest (POIs) of a specific category around the device's current position. As soon as a location fix is available the app searches for nearby gas stations and lists them, each with its icon, name, address and distance from the reference point. The example runs without a map view - it uses only the SearchService.
Search Service
A single SearchService drives the example. Its onStarted callback shows the progress bar, and onCompleted handles the outcome: on success the non-empty results are bound to a CustomAdapter for display; an empty result set shows a "no results" dialog; and any error (other than a cancellation) is reported.
Initializing Without a Map
onCreate sets up the list view and initializes the SDK. Because this example has no map view, GemSdk.initSdkWithDefaults(this) is the mandatory initialization step. It then checks that location services are enabled and requests location permission (required for the search to return relevant nearby results), verifies internet connectivity, and registers the SDK listeners.
Waiting for the Map Data and a Position Fix
The search needs both the worldwide road map and a valid position. A self-clearing onWorldwideRoadMapSupportStatus listener fires once the map data is up to date. If a GPS fix is already available it searches immediately; otherwise it registers a one-shot PositionListener that triggers the search as soon as the first valid position arrives. In both cases the position is stored as the reference used to compute distances.
Searching by Category
The actual search is a single call: searchAroundPosition is given the category to look for (EGenericCategoriesIDs.GasStation) and the reference position.
This example is hard-wired to gas stations, but you can search for any other category by passing a different EGenericCategoriesIDs value. Calling searchAroundPosition without a category instead returns the closest POIs of any type around the reference position.
Displaying the Results
When the search completes, CustomAdapter binds each Landmark to a list row. For every result it computes the distance from the reference point with coordinates?.getDistance(reference), formats it with getDistText, and fills in the landmark's icon, name and address description.
