### Custom Polygon Tile Source Example
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/CustomTileSource/README.md
Implement a custom tile source for polygon data. This example allows displaying custom polygon tiles.
```java
CustomPolygonTileSourceExample.java
```
--------------------------------
### Custom Raster Tile Source Example
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/CustomTileSource/README.md
Implement a custom tile source for raster data. This example allows displaying custom raster tiles.
```java
CustomRasterTileSourceExample.java
```
--------------------------------
### Initialize and Use a Unit
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Kotlin/HERESDKUnitsKotlin/README.md
Example of initializing a unit and updating its state within an application.
```kotlin
// 1. Init the unit.
private val helloUnit = HelloUnit()
// 2. In layout or setContent of MainActivity, add the view and inject the unit.
HelloView(unit = helloUnit)
// 3. Change the UI state.
helloUnit.setCounter(123)
```
--------------------------------
### Initialize and Set Up MapScaleUnit
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Kotlin/HERESDKUnitsKotlin/here-sdk-units-mapruler/README.md
Instantiate and set up the MapScaleUnit in your Activity or Fragment. Ensure the MapView is non-null before calling setUp.
```kotlin
private val mapScaleUnit = MapScaleUnit()
...
mapScaleUnit.setUp(mapViewNonNull)
```
--------------------------------
### Custom Line Tile Source Example
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/CustomTileSource/README.md
Implement a custom tile source for line data. This example dynamically generates line geometries within each tile.
```java
CustomLineTileSourceExample.java
```
--------------------------------
### Custom Polygon Tile Source Example
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/explore/android/Java/CustomTileSource/README.md
Implement a custom polygon tile source to display custom polygon data. This example supports data from local file system or a custom backend.
```java
This example app demonstrates how to use custom map layers, using a custom point tile source, custom raster, line and polygon layers. It enables the display of custom point, raster, line and polygon tiles with clustering features, with data sourced either from the local file system or a custom backend, regardless of the format being unknown to the HERE SDK. However, in this implementation, custom points, raster, line and polygon tiles are provided to the HERE SDK based on the requested `TileKey`, with the geodetic center of each tile added as a custom point and line geometries dynamically generated within the tile's geographical bounds. The code is designed to be flexible, allowing you to load point, raster, and line data sets stored locally or retrieved from a web service.
```
--------------------------------
### Custom Point Tile Source Example
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/CustomTileSource/README.md
Implement a custom tile source for point data. This example dynamically generates custom point and line geometries within each tile's bounds.
```java
CustomPointTileSourceExample.java
```
--------------------------------
### Add HERE SDK Credentials
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/CustomTileSource/README.md
To run the app, you need to add your HERE SDK credentials to the MainActivity.java file. Refer to the 'Get Started' section of the Developer Guide for more information.
```java
MainActivity.java
```
--------------------------------
### Setup MapSwitcher Unit in Activity
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/HERESDKUnits/here-sdk-units-mapswitcher/README.md
Initialize the MapSwitcher unit in your Activity or Fragment by finding the view and calling its setup method with the MapView and FragmentManager.
```java
private void setupMapSwitcher() {
MapSwitcherView mapSwitcherView = findViewById(R.id.map_switcher);
MapSwitcherUnit mapSwitcherUnit = mapSwitcherView.mapSwitcherUnit;
mapSwitcherUnit.setup(mapView, getSupportFragmentManager());
}
```
--------------------------------
### Custom Line Tile Source Example
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/explore/android/Java/CustomTileSource/README.md
Demonstrates how to create a custom line tile source for rendering custom line data. Data can be loaded from local files or a custom backend.
```java
You can find how this is done in [CustomPointTileSourceExample.java](app/src/main/java/com/here/sdk/customtilesource/CustomPointTileSourceExample.java), [CustomRasterTileSourceExample.java](app/src/main/java/com/here/sdk/customtilesource/CustomRasterTileSourceExample.java), [CustomLineTileSourceExample.java](app/src/main/java/com/here/sdk/customtilesource/CustomLineTileSourceExample.java) and [CustomPolygonTileSourceExample.java](app/src/main/java/com/here/sdk/customtilesource/CustomPolygonTileSourceExample.java).
```
--------------------------------
### Project Structure Overview
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/HERESDKUnits/README.md
Illustrates the basic directory structure of the HERESDKUnits project, highlighting the host app and example unit modules.
```text
HERESDKUnits/
app/ # Host app used to develop and test units
heresdk-units-mapswitcher/ # Example unit (Android Library)
...
```
--------------------------------
### Initialize CompassUnit in Activity or Fragment
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Kotlin/HERESDKUnitsKotlin/here-sdk-units-compass/README.md
Instantiate the CompassUnit and link it to the map view using the setUp method.
```kotlin
private val compassUnit = CompassUnit()
...
compassUnit.setUp(mapViewNonNull)
```
--------------------------------
### Setup MapRuler Unit in Activity/Fragment
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/HERESDKUnits/here-sdk-units-mapruler/README.md
Initialize the MapRulerUnit in your Activity or Fragment by finding the MapRulerView and calling its setup method with the mapView instance. Ensure the MapRulerView is correctly inflated in your layout.
```java
private void setupMapRuler() {
MapRulerView mapRulerView = findViewById(R.id.map_ruler);
MapRulerUnit mapRulerUnit = mapRulerView.mapRulerUnit;
mapRulerUnit.setup(mapView);
}
```
--------------------------------
### Custom Point Tile Source Example
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/explore/android/Java/CustomTileSource/README.md
Implement a custom point tile source to display custom point data on the map. Data can be sourced locally or from a backend.
```java
This example uses HERE SDK Units to support functionality such as permission handling or buttons that are not essential to the code snippets shown in this app, as the focus is on demonstrating how to use the APIs provided by the HERE SDK. The HERE SDK Units are included as AARs in the app’s `libs` folder. For more details, see the "HERESDKUnits" app to customize or create your own unit libraries. Note that this app is intended exclusively for the HERE SDK (Navigate). You can find it in the `navigate` folder. However, it can be easily adapted for the HERE SDK (Explore) by removing any code that is not supported there. At present, most components are compatible and will compile without issues.
```
--------------------------------
### Custom Raster Tile Source Example
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/explore/android/Java/CustomTileSource/README.md
Implement a custom raster tile source for displaying custom raster tile data. Supports data from local storage or a web service.
```java
1) Copy the AAR file of the HERE SDK for Android to your app's `app/libs` folder.
Note: If your AAR version is different than the version shown in the _Developer Guide_, you may need to adapt the source code of the example app.
2) Open Android Studio and sync the project.
Please do not forget: To run the app, you need to add your HERE SDK credentials to the `MainActivity.java` file. More information can be found in the _Get Started_ section of the _Developer Guide_.
```
--------------------------------
### Setup CitySelector Unit in Java Activity/Fragment
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/HERESDKUnits/here-sdk-units-cityselector/README.md
Initialize the CitySelectorView and set an OnCitySelectedListener to handle city selection events. The listener provides latitude, longitude, and city name.
```java
private void setupCitySelectorUnit() {
CitySelectorView citySelectorView = findViewById(R.id.city_selector);
citySelectorView.citySelectorUnit.setOnCitySelectedListener(
new CitySelectorUnit.OnCitySelectedListener() {
@Override
public void onCitySelected(double latitude, double longitude, String cityName) {
Log.d("CitySelector", "Selected: " + cityName +
" at " + latitude + ", " + longitude);
// Use the coordinates to navigate or center the map
}
}
);
}
```
--------------------------------
### Setup CitySelector Unit in Kotlin Activity/Fragment
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/HERESDKUnits/here-sdk-units-cityselector/README.md
Set up the CitySelectorView in your Activity or Fragment by providing a lambda function to handle city selection events. This lambda receives latitude, longitude, and city name.
```kotlin
private fun setupCitySelector(citySelectorView: CitySelectorView) {
citySelectorView.citySelectorUnit.setOnCitySelectedListener { latitude, longitude, cityName ->
Log.d("CitySelector", "Selected: $cityName at $latitude, $longitude")
// Use the coordinates to navigate or center the map
}
}
```
--------------------------------
### Add MapRulerView to Layout
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/HERESDKUnits/here-sdk-units-mapruler/README.md
Include the MapRulerView in your XML layout file to display the map scale. This example positions it in the bottom-left corner.
```xml
```
--------------------------------
### Configure PopupMenu in Java
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/HERESDKUnits/here-sdk-units-popupmenu/README.md
Initialize the menu content and define click actions within an Activity or Fragment using Java.
```java
private void setupPopupMenuUnit1() {
// Define menu entries with the code that should be executed when clicking on the item.
Map menuItems = new LinkedHashMap<>();
menuItems.put("Item 1", () -> Log.d("Menu", "Item 1 clicked"));
menuItems.put("Item 2", () -> Log.d("Menu", "Item 2 clicked"));
PopupMenuView popupMenuView = findViewById(R.id.popup_menu_button1);
PopupMenuUnit popupMenuUnit = popupMenuView.popupMenuUnit;
popupMenuUnit.setMenuContent("Menu 1", menuItems);
}
```
--------------------------------
### Initialize PopupMenuView in UI
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Kotlin/HERESDKUnitsKotlin/here-sdk-units-popupmenu/README.md
Instantiate the PopupMenuView with a button label and a map of menu items associated with their respective click actions.
```kotlin
PopupMenuView(
buttonText = "Menu", menuItems = mapOf(
"Item 1" to {
Log.d("Menu", "Item 1 selected")
},
"Item 2" to {
Log.d("Menu", "Item 2 selected")
},
"Item 3" to {
Log.d("Menu", "Item 3 selected")
}
)
)
```
--------------------------------
### Sign Commit Message Example
Source: https://github.com/heremaps/here-sdk-examples/blob/master/CONTRIBUTING.md
When filing a pull request, sign off each commit by adding 'Signed-off-by' to your commit message. This confirms agreement with the DCO.
```text
README.md: Fix minor spelling mistake
Signed-off-by: John Doe
```
--------------------------------
### Add MapScaleView to Layout
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Kotlin/HERESDKUnitsKotlin/here-sdk-units-mapruler/README.md
Include the MapScaleView in your XML layout file to display the map scale. Position it as needed, for example, in the bottom-left corner.
```xml
MapScaleView(unit = mapScaleUnit)
```
--------------------------------
### Configure Unit Module Plugins
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Kotlin/HERESDKUnitsKotlin/README.md
Apply necessary plugins and set the module version.
```gradle
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
}
version = 1.0
```
--------------------------------
### Integrate UnitDialog and UnitButton
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Kotlin/HERESDKUnitsKotlin/here-sdk-units-core/README.md
Demonstrates how to use UnitButton to trigger a UnitDialog. Ensure the dialog is managed by a state variable.
```kotlin
var showDialog by remember { mutableStateOf(false) }
UnitButton(
text = "Show Dialog",
onClick = { showDialog = true })
if (showDialog) {
// Unit Dialog with title and description only.
UnitDialog(
title = "Note: Title",
message = "This is scrollable long description message.",
onDismiss = {
showDialog = false
Log.d("Test", "UnitDialog closed")
}
)
}
```
--------------------------------
### Include All Unit AARs in libs/
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Kotlin/HERESDKUnitsKotlin/README.md
Use this Gradle dependency to include all AAR and JAR files from the libs/ folder, excluding mock JARs. This is suitable for including all example app units.
```gradle
dependencies {
implementation(fileTree("libs") {
include("*.aar", "*.jar")
exclude("*mock*.jar")
})
}
```
--------------------------------
### Execute Flutter Application
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/flutter/navigation_quick_start_app/README.md
Command to launch the application on an emulator, simulator, or connected device.
```bash
flutter run
```
--------------------------------
### Initialize SpeedLimitView in Activity
Source: https://github.com/heremaps/here-sdk-examples/blob/master/examples/latest/navigate/android/Java/HERESDKUnits/here-sdk-units-speedlimit/README.md
Configure the SpeedLimitView instance in your Activity or Fragment by setting the label and speed limit value.
```java
private void setupSpeedLimit() {
SpeedLimitView speedLimitView = findViewById(R.id.speed_limit);
speedLimitView.setLabel("Truck");
speedLimitView.setSpeedLimit("90");
}
```