├── .github
├── CODEOWNERS
├── aaos_example.png
├── splash_example.png
└── android_auto_example.png
├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── values
│ │ │ │ ├── colors.xml
│ │ │ │ ├── strings.xml
│ │ │ │ ├── styles_status.xml
│ │ │ │ └── styles.xml
│ │ │ ├── drawable
│ │ │ │ ├── mapbox_button.xml
│ │ │ │ └── ic_clear_black_24dp.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── animator
│ │ │ │ ├── scale_in.xml
│ │ │ │ └── scale_out.xml
│ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ └── layout
│ │ │ │ └── mapbox_item_view_recycler.xml
│ │ └── java
│ │ │ └── com
│ │ │ └── mapbox
│ │ │ └── navigation
│ │ │ └── examples
│ │ │ ├── standalone
│ │ │ ├── preview
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_route_preview.jpg
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── activity_preview.xml
│ │ │ ├── isochrone
│ │ │ │ └── res
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── isochrone_activity_thumbnail.jpg
│ │ │ │ │ └── layout
│ │ │ │ │ └── activity_isochrone_range_preview.xml
│ │ │ ├── replay
│ │ │ │ ├── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ │ ├── mapbox_screenshot_replay.png
│ │ │ │ │ │ └── ic_refresh.xml
│ │ │ │ │ ├── values
│ │ │ │ │ │ ├── dimen.xml
│ │ │ │ │ │ ├── styles.xml
│ │ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ │ ├── history_files_header.xml
│ │ │ │ │ │ ├── history_files_list_item.xml
│ │ │ │ │ │ └── history_files_activity.xml
│ │ │ │ ├── AdapterItem.kt
│ │ │ │ ├── HistoryFilesDirectory.kt
│ │ │ │ ├── HistoryFileLoader.kt
│ │ │ │ ├── HistoryFileAdapter.kt
│ │ │ │ ├── HistoryFilesClient.kt
│ │ │ │ └── HistoryFilesActivity.kt
│ │ │ ├── voice
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_screenshot_voice.jpg
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_play_voice_instruction.xml
│ │ │ ├── compose
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── jetpack_compose_experience.jpg
│ │ │ │ │ └── values
│ │ │ │ │ └── strings.xml
│ │ │ ├── camera
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_screenshot_basic_camera.jpg
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_camera_transitions.xml
│ │ │ ├── maneuvers
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_screenshot_maneuvers.jpg
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_show_maneuver_instructions.xml
│ │ │ ├── status
│ │ │ │ ├── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ │ ├── mapbox_screenshot_status_basic.png
│ │ │ │ │ │ └── mapbox_screenshot_status_custom.png
│ │ │ │ │ ├── values
│ │ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ │ ├── mapbox_activity_show_status.xml
│ │ │ │ │ │ └── mapbox_activity_show_custom_status.xml
│ │ │ │ ├── ShowStatusActivity.kt
│ │ │ │ └── ShowCustomStatusActivity.kt
│ │ │ ├── custompuck
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ ├── custom_puck_activity_thumbnail.jpg
│ │ │ │ │ └── puck_icon.xml
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_custom_puck.xml
│ │ │ ├── location
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_ic_user_current_location.jpg
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_user_current_location.xml
│ │ │ ├── routeline
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_screenshot_route_lines.png
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_route_line.xml
│ │ │ ├── speedlimit
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_screenshot_speed_limit.png
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_show_speed_limit.xml
│ │ │ ├── fetchroute
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_screenshot_fetch_a_route.jpg
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_fetch_a_route.xml
│ │ │ ├── turnbyturn
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_screenshot_tbt_experience.jpg
│ │ │ │ │ └── values
│ │ │ │ │ └── strings.xml
│ │ │ ├── building
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_screenshot_building_extrusion.jpg
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_building_extrusions.xml
│ │ │ ├── callout
│ │ │ │ ├── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ │ ├── mapbox_screenshot_custom_route_callout.png
│ │ │ │ │ │ ├── bg_dva_eta.xml
│ │ │ │ │ │ └── arrow_straight.xml
│ │ │ │ │ ├── values
│ │ │ │ │ │ ├── strings.xml
│ │ │ │ │ │ └── colors.xml
│ │ │ │ │ └── layout
│ │ │ │ │ │ ├── item_dva_eta.xml
│ │ │ │ │ │ ├── activity_route_callout.xml
│ │ │ │ │ │ └── item_dva_alt_eta.xml
│ │ │ │ └── BitmapUtils.kt
│ │ │ ├── tripprogress
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_screenshot_trip_progress.png
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_trip_progress.xml
│ │ │ ├── waypoints
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_screenshot_multiple_waypoints.jpg
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_multiple_waypoints.xml
│ │ │ ├── alternative
│ │ │ │ └── res
│ │ │ │ │ ├── drawable
│ │ │ │ │ └── mapbox_screenshot_alternative_routes.png
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── activity_show_alternative_routes.xml
│ │ │ ├── arrival
│ │ │ │ └── res
│ │ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_custom_arrival.xml
│ │ │ └── res
│ │ │ │ └── layout
│ │ │ │ └── activity_standalone.xml
│ │ │ ├── MapboxExample.kt
│ │ │ └── MapboxExamplesAdapter.kt
│ └── test
│ │ └── java
│ │ └── com
│ │ └── mapbox
│ │ └── navigation
│ │ └── examples
│ │ └── basics
│ │ └── WaypointsSetTest.kt
└── proguard-rules.pro
├── app-preview
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── values
│ │ │ ├── colors.xml
│ │ │ ├── strings.xml
│ │ │ └── themes.xml
│ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ ├── values-night
│ │ │ └── themes.xml
│ │ ├── layout
│ │ │ ├── activity_main.xml
│ │ │ └── mapbox_item_view_recycler.xml
│ │ └── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ └── com
│ │ │ └── mapbox
│ │ │ └── navigation
│ │ │ └── examples
│ │ │ └── preview
│ │ │ ├── copilot
│ │ │ ├── res
│ │ │ │ ├── drawable
│ │ │ │ │ ├── mapbox_screenshot_copilot.png
│ │ │ │ │ ├── ic_start.xml
│ │ │ │ │ ├── ic_stop.xml
│ │ │ │ │ ├── ic_feedback.xml
│ │ │ │ │ ├── ic_wrong_location.xml
│ │ │ │ │ ├── ic_route.xml
│ │ │ │ │ └── ic_search.xml
│ │ │ │ ├── values
│ │ │ │ │ └── strings.xml
│ │ │ │ └── layout
│ │ │ │ │ └── mapbox_activity_copilot.xml
│ │ │ └── CopilotViewModel.kt
│ │ │ ├── MapboxExample.kt
│ │ │ ├── ExamplesList.kt
│ │ │ └── MapboxExamplesAdapter.kt
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
└── build.gradle
├── feedback-agent-app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ └── themes.xml
│ │ └── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── kotlin
│ │ └── com
│ │ │ └── mapbox
│ │ │ └── navigation
│ │ │ └── examples
│ │ │ └── feedbackagent
│ │ │ ├── voicefeedback
│ │ │ ├── domain
│ │ │ │ ├── AsrData.kt
│ │ │ │ ├── AutomaticSpeechRecognitionEngine.kt
│ │ │ │ ├── FeedbackDTO.kt
│ │ │ │ ├── ASRState.kt
│ │ │ │ ├── VoiceFeedbackContextDTO.kt
│ │ │ │ └── VoiceFeedbackContextProvider.kt
│ │ │ └── VoiceFeedbackViewState.kt
│ │ │ ├── MainViewModel.kt
│ │ │ └── FeedbackAgentPermissions.kt
│ │ └── AndroidManifest.xml
├── local.properties
├── README.md
└── build.gradle
├── android-auto-app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ ├── colors.xml
│ │ │ └── themes.xml
│ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ ├── layout
│ │ │ ├── mapbox_activity_navigation_view.xml
│ │ │ └── activity_main.xml
│ │ ├── values-night
│ │ │ └── themes.xml
│ │ └── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ └── com
│ │ │ └── mapbox
│ │ │ └── navigation
│ │ │ └── examples
│ │ │ └── androidauto
│ │ │ ├── car
│ │ │ └── MainCarAppService.kt
│ │ │ ├── ExampleApplication.kt
│ │ │ ├── app
│ │ │ └── MainActivity.kt
│ │ │ └── ReplayRouteTripSession.kt
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
├── README.md
└── build.gradle
├── android-automotive-app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── mipmap-hdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ │ ├── ic_launcher.png
│ │ │ └── ic_launcher_round.png
│ │ ├── values
│ │ │ └── strings.xml
│ │ ├── mipmap-anydpi-v26
│ │ │ ├── ic_launcher.xml
│ │ │ └── ic_launcher_round.xml
│ │ └── drawable-v24
│ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ └── com
│ │ │ └── mapbox
│ │ │ └── navigation
│ │ │ └── examples
│ │ │ └── aaos
│ │ │ ├── car
│ │ │ ├── MainCarAppService.kt
│ │ │ ├── CarLocationPermissions.kt
│ │ │ ├── CarTripSessionManager.kt
│ │ │ └── ReplayRouteTripSession.kt
│ │ │ ├── ExampleApplication.kt
│ │ │ └── ExamplePermissionScreen.kt
│ │ └── AndroidManifest.xml
├── proguard-rules.pro
├── README.md
└── build.gradle
├── navigation_examples.keystore
├── gradle
├── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── script-git-version.gradle
└── ktlint.gradle
├── settings.gradle
├── .gitignore
├── LICENSE.md
├── .editorconfig
├── gradle.properties
├── CONTRIBUTING.md
├── README.md
├── .circleci
└── config.yml
└── gradlew.bat
/.github/CODEOWNERS:
--------------------------------------------------------------------------------
1 | * @mapbox/navigation-android
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | src/main/res/values/mapbox_access_token.xml
--------------------------------------------------------------------------------
/app-preview/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | src/main/res/values/mapbox_access_token.xml
--------------------------------------------------------------------------------
/feedback-agent-app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | src/main/res/values/mapbox_access_token.xml
--------------------------------------------------------------------------------
/android-auto-app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | src/main/res/values/mapbox_access_token.xml
3 |
--------------------------------------------------------------------------------
/android-automotive-app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | src/main/res/values/mapbox_access_token.xml
--------------------------------------------------------------------------------
/.github/aaos_example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/.github/aaos_example.png
--------------------------------------------------------------------------------
/.github/splash_example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/.github/splash_example.png
--------------------------------------------------------------------------------
/navigation_examples.keystore:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/navigation_examples.keystore
--------------------------------------------------------------------------------
/.github/android_auto_example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/.github/android_auto_example.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Feedback Agent
4 |
--------------------------------------------------------------------------------
/app-preview/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app-preview/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app-preview/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app-preview/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app-preview/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app-preview/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app-preview/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app-preview/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app-preview/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app-preview/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-auto-app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-auto-app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-auto-app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app-preview/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app-preview/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app-preview/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app-preview/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-auto-app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-auto-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app-preview/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app-preview/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app-preview/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app-preview/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/feedback-agent-app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-auto-app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-auto-app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-automotive-app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-automotive-app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app-preview/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app-preview/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-auto-app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-auto-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-automotive-app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-automotive-app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-auto-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-automotive-app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-automotive-app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-automotive-app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-automotive-app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-automotive-app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/android-automotive-app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include (
2 | ':app',
3 | ':app-preview',
4 | ':android-auto-app',
5 | ':android-automotive-app',
6 | ':feedback-agent-app'
7 | )
8 | rootProject.name = "Mapbox Navigation Examples"
9 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AA-app
3 |
4 | Hello blank fragment
5 |
--------------------------------------------------------------------------------
/app-preview/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #6200EE
4 | #3700B3
5 | #03DAC5
6 |
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/preview/res/drawable/mapbox_route_preview.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/preview/res/drawable/mapbox_route_preview.jpg
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/isochrone/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Isochrone Range Preview
3 | Demonstrates using an isochrone.
4 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/res/drawable/mapbox_screenshot_replay.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/res/drawable/mapbox_screenshot_replay.png
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/voice/res/drawable/mapbox_screenshot_voice.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/voice/res/drawable/mapbox_screenshot_voice.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable/mapbox_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Gradle
2 | .gradle
3 | /local.properties
4 |
5 | # IntelliJ
6 | out/
7 |
8 | build/
9 | /captures
10 | .externalNativeBuild
11 |
12 | # Idea
13 | .idea
14 | *.iml
15 |
16 | #MacOS
17 | .DS_Store
18 |
19 | jacoco.exec
20 | app/src/main/res/values/mapbox_access_token.xml
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/compose/res/drawable/jetpack_compose_experience.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/compose/res/drawable/jetpack_compose_experience.jpg
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/copilot/res/drawable/mapbox_screenshot_copilot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app-preview/src/main/java/com/mapbox/navigation/examples/preview/copilot/res/drawable/mapbox_screenshot_copilot.png
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/copilot/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Copilot
4 | The example demonstrates how to integrate and work with Copilot.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/camera/res/drawable/mapbox_screenshot_basic_camera.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/camera/res/drawable/mapbox_screenshot_basic_camera.jpg
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/isochrone/res/drawable/isochrone_activity_thumbnail.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/isochrone/res/drawable/isochrone_activity_thumbnail.jpg
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/maneuvers/res/drawable/mapbox_screenshot_maneuvers.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/maneuvers/res/drawable/mapbox_screenshot_maneuvers.jpg
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/status/res/drawable/mapbox_screenshot_status_basic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/status/res/drawable/mapbox_screenshot_status_basic.png
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/status/res/drawable/mapbox_screenshot_status_custom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/status/res/drawable/mapbox_screenshot_status_custom.png
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | To the extent possible under law, Mapbox has waived all copyright and related or neighboring rights to Mapbox Navigation SDK Examples. This work is published from the United States.
2 |
3 | CC0 1.0 Universal (CC0 1.0)
4 | Public Domain Dedication
5 | https://creativecommons.org/publicdomain/zero/1.0/
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/custompuck/res/drawable/custom_puck_activity_thumbnail.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/custompuck/res/drawable/custom_puck_activity_thumbnail.jpg
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/location/res/drawable/mapbox_ic_user_current_location.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/location/res/drawable/mapbox_ic_user_current_location.jpg
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/routeline/res/drawable/mapbox_screenshot_route_lines.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/routeline/res/drawable/mapbox_screenshot_route_lines.png
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/speedlimit/res/drawable/mapbox_screenshot_speed_limit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/speedlimit/res/drawable/mapbox_screenshot_speed_limit.png
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | AAOS-app
3 | Accept permissions to continue
4 | Location permissions
5 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/fetchroute/res/drawable/mapbox_screenshot_fetch_a_route.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/fetchroute/res/drawable/mapbox_screenshot_fetch_a_route.jpg
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/turnbyturn/res/drawable/mapbox_screenshot_tbt_experience.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/turnbyturn/res/drawable/mapbox_screenshot_tbt_experience.jpg
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/building/res/drawable/mapbox_screenshot_building_extrusion.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/building/res/drawable/mapbox_screenshot_building_extrusion.jpg
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/callout/res/drawable/mapbox_screenshot_custom_route_callout.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/callout/res/drawable/mapbox_screenshot_custom_route_callout.png
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/tripprogress/res/drawable/mapbox_screenshot_trip_progress.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/tripprogress/res/drawable/mapbox_screenshot_trip_progress.png
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/waypoints/res/drawable/mapbox_screenshot_multiple_waypoints.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/waypoints/res/drawable/mapbox_screenshot_multiple_waypoints.jpg
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.{kt,kts}]
2 | ktlint_code_style = ktlint_official
3 | ktlint_disabled_rules=argument-list-wrapping,multiline-if-else,no-empty-first-line-in-method-block,spacing-between-declarations-with-annotations,spacing-between-declarations-with-comments,trailing-comma-on-declaration-site,trailing-comma-on-call-site
4 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/alternative/res/drawable/mapbox_screenshot_alternative_routes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mapbox/mapbox-navigation-android-examples/HEAD/app/src/main/java/com/mapbox/navigation/examples/standalone/alternative/res/drawable/mapbox_screenshot_alternative_routes.png
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/res/values/dimen.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 180dp
5 | 16dp
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/MapboxExample.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples
2 |
3 | import android.graphics.drawable.Drawable
4 |
5 | data class MapboxExample(
6 | val image: Drawable?,
7 | val title: String,
8 | val description: String,
9 | val activity: Class<*>
10 | )
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/callout/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Draw custom route callouts
3 | Customize route callouts using MapboxRouteCalloutAdapter.
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app-preview/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app-preview/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Mapbox Navigation Examples
3 |
4 | Error: no mapbox access token
5 | Please put your mapbox access token to res/values/mapbox_access_token.xml
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app-preview/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Mapbox Navigation Examples Preview
3 |
4 | Error: no mapbox access token
5 | Please put your mapbox access token to res/values/mapbox_access_token.xml
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/custompuck/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Use a custom 2D or 3D puck
4 | Demonstrates using a custom 2D or 3D puck.
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/maneuvers/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Render maneuver instructions for a route
4 | Draw maneuver instructions using the Maneuver API and MapboxManeuverView.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/voice/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Play voice instructions for a route
4 | Use the example to play voice instructions using Speech API and Voice Instruction Player.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/MapboxExample.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.preview
2 |
3 | import android.graphics.drawable.Drawable
4 |
5 | data class MapboxExample(
6 | val image: Drawable?,
7 | val title: String,
8 | val description: String,
9 | val activity: Class<*>
10 | )
11 |
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/speedlimit/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Render speed limit for a route
4 | Render the speed limit of the current road using the Speed Limit API and MapboxSpeedLimitView.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/tripprogress/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Render trip progress information
4 | Draw trip progress information using the Trip Progress API and MapboxTripProgressView.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/location/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Render current location on a map
4 | Use NavigationLocationProvider to show a device\'s current location as a puck on a map.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/camera/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Use camera to frame the map
4 | Use NavigationCamera to show various map camera transitions using live location and routing data.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/building/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Render building extrusion on arrival
4 | Use the example to render building extrusions on arrival using building API and MapboxBuildingView.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/turnbyturn/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Add a complete turn-by-turn experience
4 | Render a complete turn-by-turn experience using all relevant Navigation SDK APIs and pre-built UI components.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/routeline/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Draw route lines and callouts on a map
4 | Draw route lines on a map using the route line and route arrow APIs and the related MapboxRouteLineView and MapboxRouteArrowView.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/copilot/res/drawable/ic_start.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/copilot/res/drawable/ic_stop.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/feedback-agent-app/local.properties:
--------------------------------------------------------------------------------
1 | ## This file must *NOT* be checked into Version Control Systems,
2 | # as it contains information specific to your local configuration.
3 | #
4 | # Location of the SDK. This is only used by Gradle.
5 | # For customization when using a Version Control System, please read the
6 | # header note.
7 | #Thu Aug 07 15:46:41 CEST 2025
8 | sdk.dir=/Users/pabloguardiola/Library/Android/sdk
9 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/AdapterItem.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.standalone.replay
2 |
3 | sealed class AdapterItem
4 |
5 | data class ReplayPath(
6 | val title: String,
7 | val description: String,
8 | val path: String,
9 | val dataSource: ReplayDataSource
10 | ) : AdapterItem()
11 |
12 | class Header(val title: String) : AdapterItem()
13 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/compose/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Add a complete turn-by-turn experience using Jetpack Compose
4 | Render a complete turn-by-turn experience in Jetpack Compose using all relevant Navigation SDK APIs and pre-built UI components.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/preview/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Route Preview
3 | Preview a route before navigation.
4 | Start active guidance
5 | Finish active guidance
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/arrival/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Render building extrusion based on custom arrival criteria.
4 | Use the example to render building extrusions on arrival using building API and MapboxBuildingView.
5 |
6 |
7 |
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/kotlin/com/mapbox/navigation/examples/feedbackagent/voicefeedback/domain/AsrData.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.feedbackagent.voicefeedback.domain
2 |
3 | internal sealed interface AsrData {
4 | data class Transcript(
5 | val text: String,
6 | ) : AsrData
7 |
8 | data class Result(
9 | val description: String,
10 | val type: String,
11 | ) : AsrData
12 | }
13 |
--------------------------------------------------------------------------------
/android-automotive-app/src/main/java/com/mapbox/navigation/examples/aaos/car/MainCarAppService.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.aaos.car
2 |
3 | import androidx.car.app.CarAppService
4 | import androidx.car.app.validation.HostValidator
5 |
6 | class MainCarAppService : CarAppService() {
7 | override fun createHostValidator() = HostValidator.ALLOW_ALL_HOSTS_VALIDATOR
8 |
9 | override fun onCreateSession() = MainCarSession()
10 | }
11 |
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/copilot/res/drawable/ic_feedback.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_clear_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/java/com/mapbox/navigation/examples/androidauto/car/MainCarAppService.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.androidauto.car
2 |
3 | import androidx.car.app.CarAppService
4 | import androidx.car.app.validation.HostValidator
5 |
6 | class MainCarAppService : CarAppService() {
7 | override fun createHostValidator() = HostValidator.ALLOW_ALL_HOSTS_VALIDATOR
8 |
9 | override fun onCreateSession() = MainCarSession()
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/alternative/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Set route
4 | Request alternative route
5 | Show alternative routes
6 | Use the example to show alternative routes using routes API.
7 |
8 |
9 |
--------------------------------------------------------------------------------
/gradle/script-git-version.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenCentral()
4 | }
5 | dependencies {
6 | classpath 'org.ajoberstar.grgit:grgit-core:4.1.1'
7 | }
8 | }
9 |
10 | import org.ajoberstar.grgit.Grgit
11 |
12 | ext {
13 | git = Grgit.open(currentDir: projectDir)
14 | gitCommitHash = git.head().abbreviatedId
15 | gitNumberOfCommits = git.log().size()
16 | gitTagDescription = git.describe(tags: true)
17 | git.close()
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/callout/res/drawable/bg_dva_eta.xml:
--------------------------------------------------------------------------------
1 |
7 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/custompuck/res/layout/mapbox_activity_custom_puck.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/layout/mapbox_activity_navigation_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/kotlin/com/mapbox/navigation/examples/feedbackagent/voicefeedback/domain/AutomaticSpeechRecognitionEngine.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.feedbackagent.voicefeedback.domain
2 |
3 | import kotlinx.coroutines.flow.StateFlow
4 |
5 | internal interface AutomaticSpeechRecognitionEngine {
6 |
7 | val state: StateFlow
8 |
9 | fun startListening()
10 |
11 | fun stopListening()
12 |
13 | fun connect()
14 |
15 | fun disconnect()
16 | }
17 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/callout/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #4264fb
4 | #00195F
5 | #AFADAD
6 | #424242
7 | #09AA74
8 | #AA093F
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/status/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Show status messages
4 | Learn how to use MapboxStatusView to show status messages.
5 | Show customized status messages
6 | Learn how to customize MapboxStatusView to match your application theme.
7 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/scale_in.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
9 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/animator/scale_out.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
9 |
14 |
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/kotlin/com/mapbox/navigation/examples/feedbackagent/voicefeedback/domain/FeedbackDTO.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.feedbackagent.voicefeedback.domain
2 |
3 | import kotlinx.serialization.SerialName
4 | import kotlinx.serialization.Serializable
5 |
6 | internal const val FEEDBACK_ACTION_TYPE = "feedback"
7 |
8 | @Serializable
9 | internal data class FeedbackDTO(
10 | @SerialName("feedbackType")
11 | val feedbackType: String,
12 | @SerialName("feedbackDescription")
13 | val feedbackDescription: String,
14 | )
15 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/waypoints/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Build a multiple waypoints route
4 | Build a route using different types of waypoints: regular, silent, and named.
5 | Reset the route
6 | Regular
7 | Named
8 | Silent
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app-preview/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/app-preview/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/ExamplesList.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.preview
2 |
3 | import android.content.Context
4 | import androidx.core.content.ContextCompat
5 | import com.mapbox.navigation.examples.preview.copilot.CopilotActivity
6 |
7 | fun Context.examplesList() = listOf(
8 | MapboxExample(
9 | ContextCompat.getDrawable(
10 | this,
11 | R.drawable.mapbox_screenshot_copilot
12 | ),
13 | getString(R.string.title_copilot),
14 | getString(R.string.description_copilot),
15 | CopilotActivity::class.java
16 | ),
17 | )
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/fetchroute/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Route was fetched successfully
4 | Route request was canceled
5 | Route request returned error
6 | Fetch routes between an origin and destination
7 | Fetch routes by specifying two coordinates in RouteOptions and passing those options to MapboxNavigation\'s requestRoutes method.
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/res/drawable/ic_refresh.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
--------------------------------------------------------------------------------
/android-automotive-app/src/main/java/com/mapbox/navigation/examples/aaos/ExampleApplication.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.aaos
2 |
3 | import android.app.Application
4 | import com.mapbox.navigation.base.options.NavigationOptions
5 | import com.mapbox.navigation.core.lifecycle.MapboxNavigationApp
6 |
7 | class ExampleApplication : Application() {
8 |
9 | override fun onCreate() {
10 | super.onCreate()
11 |
12 | // Set up MapboxNavigation
13 | MapboxNavigationApp.setup(
14 | NavigationOptions.Builder(applicationContext)
15 | .accessToken(getString(R.string.mapbox_access_token))
16 | .build()
17 | ).attachAllActivities(this)
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/java/com/mapbox/navigation/examples/androidauto/ExampleApplication.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.androidauto
2 |
3 | import android.app.Application
4 | import com.mapbox.navigation.base.options.NavigationOptions
5 | import com.mapbox.navigation.core.lifecycle.MapboxNavigationApp
6 |
7 | class ExampleApplication : Application() {
8 |
9 | override fun onCreate() {
10 | super.onCreate()
11 |
12 | // Setup MapboxNavigation
13 | MapboxNavigationApp.setup(
14 | NavigationOptions.Builder(applicationContext)
15 | .accessToken(getString(R.string.mapbox_access_token))
16 | .build()
17 | ).attachAllActivities(this)
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/gradle/ktlint.gradle:
--------------------------------------------------------------------------------
1 | configurations {
2 | ktlint
3 | }
4 |
5 | dependencies {
6 | ktlint "com.pinterest:ktlint:0.47.1"
7 | }
8 |
9 | def inputFiles = project.fileTree(dir: "src", include: "**/*.kt")
10 |
11 | task ktlint(type: JavaExec, group: "verification") {
12 | inputs.files(inputFiles)
13 |
14 | description = "Check Kotlin code style."
15 | main = "com.pinterest.ktlint.Main"
16 | classpath = configurations.ktlint
17 | args "src/**/*.kt"
18 | }
19 | check.dependsOn ktlint
20 |
21 | task ktlintFormat(type: JavaExec, group: "formatting") {
22 | description = "Fix Kotlin code style deviations."
23 | main = "com.pinterest.ktlint.Main"
24 | classpath = configurations.ktlint
25 | args "-F", "src/**/*.kt"
26 | }
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/kotlin/com/mapbox/navigation/examples/feedbackagent/voicefeedback/VoiceFeedbackViewState.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.feedbackagent.voicefeedback
2 |
3 | internal data class VoiceFeedbackViewState(
4 | val state: String = "Disconnected",
5 | val connectionAvailable: Boolean = true,
6 | val disconnectionAvailable: Boolean = false,
7 | val startListeningAvailable: Boolean = false,
8 | val stopListeningAvailable: Boolean = false,
9 | val showSuccessMessage: Boolean = false,
10 | val successMessage: String = "",
11 | val errorState: ErrorState? = null,
12 | ) {
13 |
14 | data class ErrorState(
15 | val message: String,
16 | val isRetryable: Boolean = true,
17 | )
18 | }
19 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/copilot/res/drawable/ic_wrong_location.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/copilot/res/drawable/ic_route.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app-preview/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/location/res/layout/mapbox_activity_user_current_location.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
--------------------------------------------------------------------------------
/android-auto-app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/android-automotive-app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/copilot/res/drawable/ic_search.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/isochrone/res/layout/activity_isochrone_range_preview.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/res/layout/history_files_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/callout/res/drawable/arrow_straight.xml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
9 |
12 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app-preview/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/HistoryFilesDirectory.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.standalone.replay
2 |
3 | import android.content.Context
4 | import com.mapbox.navigation.core.history.MapboxHistoryReader
5 | import java.io.File
6 |
7 | private const val DIRECTORY_NAME = "replay"
8 |
9 | /**
10 | * Helper class that designates a directory for replay. The files in this
11 | * directory are then used with the [MapboxHistoryReader].
12 | */
13 | object HistoryFilesDirectory {
14 | /**
15 | * The directory where the replay files are stored.
16 | */
17 | private fun replayDirectory(context: Context): File =
18 | File(context.filesDir, DIRECTORY_NAME).also { it.mkdirs() }
19 |
20 | /**
21 | * Returns a file in the [replayDirectory] where a history file can be written.
22 | */
23 | fun outputFile(context: Context, path: String): File =
24 | File(replayDirectory(context), path)
25 | }
26 |
--------------------------------------------------------------------------------
/app-preview/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/res/layout/activity_standalone.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/custompuck/res/drawable/puck_icon.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
11 |
14 |
17 |
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
13 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/java/com/mapbox/navigation/examples/androidauto/app/MainActivity.kt:
--------------------------------------------------------------------------------
1 |
2 | package com.mapbox.navigation.examples.androidauto.app
3 |
4 | import android.os.Bundle
5 | import androidx.appcompat.app.AppCompatActivity
6 | import com.mapbox.navigation.examples.androidauto.CarAppSyncComponent
7 | import com.mapbox.navigation.examples.androidauto.databinding.MapboxActivityNavigationViewBinding
8 |
9 | class MainActivity : AppCompatActivity() {
10 | private lateinit var binding: MapboxActivityNavigationViewBinding
11 |
12 | override fun onCreate(savedInstanceState: Bundle?) {
13 | super.onCreate(savedInstanceState)
14 | binding = MapboxActivityNavigationViewBinding.inflate(layoutInflater)
15 | setContentView(binding.root)
16 |
17 | // TODO going to expose a public api to share a replay controller
18 | // This allows to simulate your location
19 | // binding.navigationView.api.routeReplayEnabled(true)
20 |
21 | CarAppSyncComponent.getInstance().setNavigationView(binding.navigationView)
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Replay Example
4 | Demonstrates the use of replay API.
5 | Replay speed %d
6 | Play history
7 | Select history
8 | Paused
9 | History failed to load item
10 | Failed to load list
11 | Local history file
12 | Replay directory
13 | Recorded history file
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles_status.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
15 |
16 |
23 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/callout/res/layout/item_dva_eta.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/kotlin/com/mapbox/navigation/examples/feedbackagent/MainViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.feedbackagent
2 |
3 | import android.app.Application
4 | import androidx.lifecycle.AndroidViewModel
5 | import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
6 | import com.mapbox.navigation.mapgpt.core.common.SharedLog
7 | import kotlinx.coroutines.flow.MutableStateFlow
8 | import kotlinx.coroutines.flow.asStateFlow
9 | import kotlinx.coroutines.flow.update
10 |
11 | @OptIn(ExperimentalPreviewMapboxNavigationAPI::class)
12 | internal class MainViewModel(application: Application) : AndroidViewModel(application) {
13 |
14 | private val _state = MutableStateFlow(AppState())
15 | val state = _state.asStateFlow()
16 |
17 | fun onPermissionsGranted(granted: Boolean) {
18 | SharedLog.i(TAG) { "onPermissionsGranted $granted" }
19 | _state.update { it.copy(permissionsGranted = granted) }
20 | }
21 |
22 | companion object {
23 | private const val TAG = "MainViewModel"
24 | }
25 | }
26 |
27 | @OptIn(ExperimentalPreviewMapboxNavigationAPI::class)
28 | data class AppState(
29 | val permissionsGranted: Boolean = false,
30 | )
31 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/status/res/layout/mapbox_activity_show_status.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/res/layout/history_files_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
22 |
23 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/android-automotive-app/src/main/java/com/mapbox/navigation/examples/aaos/car/CarLocationPermissions.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.aaos.car
2 |
3 | import android.Manifest
4 | import android.util.Log
5 | import androidx.car.app.CarContext
6 | import com.mapbox.android.core.permissions.PermissionsManager
7 | import kotlinx.coroutines.flow.MutableStateFlow
8 | import kotlinx.coroutines.flow.asStateFlow
9 |
10 | class CarLocationPermissions {
11 |
12 | private val locationPermissions = listOf(
13 | Manifest.permission.ACCESS_COARSE_LOCATION,
14 | Manifest.permission.ACCESS_FINE_LOCATION
15 | )
16 |
17 | private val _grantedState = MutableStateFlow(false)
18 | val grantedState = _grantedState.asStateFlow()
19 |
20 | fun requestPermissions(carContext: CarContext) {
21 | if (PermissionsManager.areLocationPermissionsGranted(carContext)) {
22 | Log.i("CarLocationPermissions", "Permissions already granted")
23 | _grantedState.value = true
24 | } else {
25 | Log.i("CarLocationPermissions", "Requesting permissions")
26 | carContext.requestPermissions(locationPermissions) { grantedPermissions, _ ->
27 | if (locationPermissions.any { grantedPermissions.contains(it) }) {
28 | _grantedState.value = true
29 | }
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/alternative/res/layout/activity_show_alternative_routes.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/status/res/layout/mapbox_activity_show_custom_status.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
16 |
17 |
21 |
22 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/callout/res/layout/activity_route_callout.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/android-automotive-app/README.md:
--------------------------------------------------------------------------------
1 | # Mapbox Navigation Android-Auto SDK Examples
2 |
3 | The android-automotive-app showcases the minimum integration needed to support the android-automotive in your application.
4 |
5 |
6 |

7 |
8 |
9 | ## Installation
10 |
11 | 1. Change "Configuration" of "android-automotive-app". "Launch Options - Launch" should be "Nothing"
12 | 1. Update or create the "mapbox_access_token.xml" under "android-auto-app/src/main/res/values" and put below
13 |
14 |
15 | PUBLIC TOKEN HERE
16 |
17 | 1. Establish Android Automotive developer environment by following [Google's document](https://developer.android.com/training/cars/testing#test-automotive-os)
18 | 1. Run "android-automotive-app" which installs the app onto the Automotive emulator
19 |
20 | ## Enable route replay (AUTO_DRIVE)
21 |
22 | When testing Android Auto, it is easy to simulate a route instead of using mock locations. Follow these instructions, to enable route replay.
23 | https://docs.mapbox.com/android/navigation/guides/developer-tools/route-replay/
24 |
25 | ```
26 | 2. Open your navigation app
27 | 3. $ adb shell dumpsys activity service com.mapbox.navigation.examples.aaos.car.MainCarAppService AUTO_DRIVE
28 | ```
29 |
--------------------------------------------------------------------------------
/android-automotive-app/src/main/java/com/mapbox/navigation/examples/aaos/ExamplePermissionScreen.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.aaos
2 |
3 | import android.util.Log
4 | import androidx.car.app.CarContext
5 | import androidx.car.app.Screen
6 | import androidx.car.app.model.Action
7 | import androidx.car.app.model.MessageTemplate
8 | import androidx.car.app.model.Template
9 | import com.mapbox.navigation.examples.aaos.car.CarLocationPermissions
10 |
11 | internal class ExamplePermissionScreen(
12 | carContext: CarContext,
13 | private val carLocationPermissions: CarLocationPermissions,
14 | ) : Screen(carContext) {
15 | override fun onGetTemplate(): Template {
16 | Log.i(TAG, "Request permissions onGetTemplate")
17 | return MessageTemplate.Builder(
18 | carContext.getString(R.string.example_permission_screen_message)
19 | ).setTitle(
20 | carContext.getString(R.string.example_permission_screen_title)
21 | ).addAction(
22 | Action.Builder()
23 | .setTitle(carContext.getString(com.mapbox.androidauto.R.string.car_label_ok))
24 | .setOnClickListener {
25 | Log.i(TAG, "Request permissions click")
26 | carLocationPermissions.requestPermissions(carContext)
27 | }
28 | .build()
29 | ).build()
30 | }
31 |
32 | private companion object {
33 | private const val TAG = "ExamplePermissionScreen"
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/arrival/res/layout/mapbox_activity_custom_arrival.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
32 |
33 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
25 |
26 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/kotlin/com/mapbox/navigation/examples/feedbackagent/FeedbackAgentPermissions.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.feedbackagent
2 |
3 | import androidx.activity.ComponentActivity
4 | import androidx.activity.result.ActivityResultLauncher
5 | import androidx.activity.result.contract.ActivityResultContracts
6 | import androidx.core.content.ContextCompat
7 |
8 | class FeedbackAgentPermissions(
9 | private val componentActivity: ComponentActivity,
10 | private val onPermissionsResult: (Boolean) -> Unit,
11 | ) {
12 |
13 | private val requiredPermissions = arrayOf(
14 | android.Manifest.permission.RECORD_AUDIO,
15 | android.Manifest.permission.ACCESS_FINE_LOCATION,
16 | )
17 |
18 | private val permissionLauncher: ActivityResultLauncher> =
19 | componentActivity.registerForActivityResult(
20 | ActivityResultContracts.RequestMultiplePermissions(),
21 | ) { permissions ->
22 | val granted = permissions.entries.all { it.value }
23 | onPermissionsResult(granted)
24 | }
25 |
26 | fun requestPermissions() {
27 | val notGranted = requiredPermissions.filter {
28 | val selfPermission = ContextCompat.checkSelfPermission(componentActivity, it)
29 | selfPermission != android.content.pm.PackageManager.PERMISSION_GRANTED
30 | }
31 |
32 | if (notGranted.isNotEmpty()) {
33 | permissionLauncher.launch(notGranted.toTypedArray())
34 | } else {
35 | // all permissions already granted
36 | onPermissionsResult(true)
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/feedback-agent-app/README.md:
--------------------------------------------------------------------------------
1 | # Feedback Agent App
2 |
3 | This module demonstrates the Mapbox Navigation SDK's voice feedback capabilities. It provides a simple interface for users to provide voice feedback during navigation sessions.
4 |
5 | ## Features
6 |
7 | - Voice feedback recording and processing
8 | - Real-time speech recognition display
9 | - Feedback submission to Mapbox Navigation SDK
10 | - Clean Material 3 UI with Jetpack Compose
11 |
12 | ## Usage
13 |
14 | 1. Tap "Connect" to establish connection with the voice feedback service
15 | 2. Tap "Start Listening" to begin voice input
16 | 3. Speak your feedback
17 | 4. Tap "Stop Listening" to end recording and submit feedback
18 | 5. View feedback submission results
19 |
20 | ## Architecture
21 |
22 | The app follows a MVVM architecture pattern with:
23 |
24 | - `VoiceFeedbackView` - Compose UI for the feedback interface
25 | - `VoiceFeedbackViewModel` - Business logic and state management
26 | - `AutomaticSpeechRecognitionEngine` - ASR integration layer
27 | - Domain models for speech recognition states and feedback DTOs
28 |
29 | ## Dependencies
30 |
31 | - Mapbox Navigation SDK v3.11.0
32 | - Jetpack Compose for UI
33 | - Kotlin Coroutines for async operations
34 | - Android microphone middleware for audio capture
35 |
36 | ## Permissions
37 |
38 | The app requires microphone permissions to capture voice feedback. The app will prompt for permissions on first launch.
39 |
40 | ## Technical Implementation
41 |
42 | - Uses MapGPT experimental APIs for speech recognition infrastructure
43 | - AudioLiteMicrophoneMiddleware for microphone access
44 | - Integration with Mapbox Navigation SDK telemetry for feedback submission
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/MapboxExamplesAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples
2 |
3 | import android.view.LayoutInflater
4 | import android.view.ViewGroup
5 | import androidx.recyclerview.widget.RecyclerView
6 | import com.mapbox.navigation.examples.databinding.MapboxItemViewRecyclerBinding
7 |
8 | class MapboxExamplesAdapter(
9 | private val examplesList: List,
10 | private val itemClickLambda: (position: Int) -> Unit
11 | ) : RecyclerView.Adapter() {
12 |
13 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MapboxExamplesViewHolder {
14 | val binding = MapboxItemViewRecyclerBinding.inflate(
15 | LayoutInflater.from(parent.context), parent, false
16 | )
17 | return MapboxExamplesViewHolder(binding)
18 | }
19 |
20 | override fun getItemCount(): Int = examplesList.size
21 |
22 | override fun onBindViewHolder(holder: MapboxExamplesViewHolder, position: Int) {
23 | with(holder) { bindItem(examplesList[position]) }
24 | }
25 |
26 | inner class MapboxExamplesViewHolder(
27 | private val viewBinding: MapboxItemViewRecyclerBinding
28 | ) : RecyclerView.ViewHolder(viewBinding.root) {
29 | fun bindItem(example: MapboxExample) {
30 | viewBinding.itemImage.setImageDrawable(example.image)
31 | viewBinding.itemTitle.text = example.title
32 | viewBinding.itemDescription.text = example.description
33 |
34 | viewBinding.root.setOnClickListener {
35 | itemClickLambda(layoutPosition)
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/building/res/layout/mapbox_activity_building_extrusions.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
34 |
35 |
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/MapboxExamplesAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.preview
2 |
3 | import android.view.LayoutInflater
4 | import android.view.ViewGroup
5 | import androidx.recyclerview.widget.RecyclerView
6 | import com.mapbox.navigation.examples.preview.databinding.MapboxItemViewRecyclerBinding
7 |
8 | class MapboxExamplesAdapter(
9 | private val examplesList: List,
10 | private val itemClickLambda: (position: Int) -> Unit
11 | ) : RecyclerView.Adapter() {
12 |
13 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MapboxExamplesViewHolder {
14 | val binding = MapboxItemViewRecyclerBinding.inflate(
15 | LayoutInflater.from(parent.context), parent, false
16 | )
17 | return MapboxExamplesViewHolder(binding)
18 | }
19 |
20 | override fun getItemCount(): Int = examplesList.size
21 |
22 | override fun onBindViewHolder(holder: MapboxExamplesViewHolder, position: Int) {
23 | with(holder) { bindItem(examplesList[position]) }
24 | }
25 |
26 | inner class MapboxExamplesViewHolder(
27 | private val viewBinding: MapboxItemViewRecyclerBinding
28 | ) : RecyclerView.ViewHolder(viewBinding.root) {
29 | fun bindItem(example: MapboxExample) {
30 | viewBinding.itemImage.setImageDrawable(example.image)
31 | viewBinding.itemTitle.text = example.title
32 | viewBinding.itemDescription.text = example.description
33 |
34 | viewBinding.root.setOnClickListener {
35 | itemClickLambda(layoutPosition)
36 | }
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/android-auto-app/README.md:
--------------------------------------------------------------------------------
1 | # Mapbox Navigation Android-Auto SDK Examples
2 |
3 | The android-auto-app showcases the minimum integration needed to support the android-auto module in your application, it's a portable example that can be copied into your app. See instructions for integrating below.
4 |
5 |
6 |

7 |
8 |
9 | ## Installation
10 |
11 | 1. Change "Configuration" of "android-auto-app". "Launch Options - Launch" should be "Nothing"
12 | 1. Update or create the "mapbox_access_token.xml" under "android-auto-app/src/main/res/values" and put below
13 |
14 |
15 | PUBLIC TOKEN HERE
16 |
17 | 1. Establish Android Auto environment by following [Google's document](https://developer.android.com/training/cars/testing) or [Readme](https://github.com/mapbox/mapbox-navigation-android-examples/blob/main/android-auto/README.md)
18 | 1. Run "android-auto-app" which installs the app on your device
19 | 1. Run the app on "Desktop Head Unit"
20 |
21 | ## Enable route replay (AUTO_DRIVE)
22 |
23 | When testing Android Auto, it is easy to simulate a route instead of using mock locations. Follow these instructions, to enable route replay.
24 | https://docs.mapbox.com/android/navigation/guides/developer-tools/route-replay/
25 |
26 | ```
27 | 1. Start the desktop head unit
28 | 2. Open your navigation app
29 | 3. $ adb shell dumpsys activity service com.mapbox.navigation.examples.androidauto.car.MainCarAppService AUTO_DRIVE
30 | ```
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app-preview/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/callout/BitmapUtils.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.standalone.callout
2 |
3 | import android.graphics.Bitmap
4 | import android.graphics.Canvas
5 | import android.graphics.drawable.BitmapDrawable
6 | import android.graphics.drawable.Drawable
7 | import androidx.annotation.ColorInt
8 |
9 | /**
10 | * Utility class to work with bitmaps and drawables.
11 | */
12 | object BitmapUtils {
13 |
14 | fun drawableToBitmap(
15 | sourceDrawable: Drawable?,
16 | flipX: Boolean = false,
17 | flipY: Boolean = false,
18 | @ColorInt tint: Int? = null,
19 | ): Bitmap? {
20 | if (sourceDrawable == null) {
21 | return null
22 | }
23 | return if (sourceDrawable is BitmapDrawable) {
24 | sourceDrawable.bitmap
25 | } else {
26 | // copying drawable object to not manipulate on the same reference
27 | val constantState = sourceDrawable.constantState ?: return null
28 | val drawable = constantState.newDrawable().mutate()
29 | val bitmap = Bitmap.createBitmap(
30 | drawable.intrinsicWidth, drawable.intrinsicHeight,
31 | Bitmap.Config.ARGB_8888
32 | )
33 | tint?.let(drawable::setTint)
34 | val canvas = Canvas(bitmap)
35 | drawable.setBounds(0, 0, canvas.width, canvas.height)
36 | canvas.scale(
37 | if (flipX) -1f else 1f,
38 | if (flipY) -1f else 1f,
39 | canvas.width / 2f,
40 | canvas.height / 2f
41 | )
42 | drawable.draw(canvas)
43 | bitmap
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/preview/res/layout/activity_preview.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
17 |
18 |
28 |
29 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/fetchroute/res/layout/mapbox_activity_fetch_a_route.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
22 |
23 |
24 |
25 |
39 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/android-automotive-app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/callout/res/layout/item_dva_alt_eta.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
23 |
24 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/android-auto-app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-parcelize'
4 | apply plugin: 'kotlin-kapt'
5 | apply plugin: 'com.mapbox.maps.token'
6 | apply from: "${rootDir}/gradle/script-git-version.gradle"
7 | apply from: "${rootDir}/gradle/ktlint.gradle"
8 |
9 | android {
10 | namespace "com.mapbox.navigation.examples.androidauto"
11 | compileSdkVersion 33
12 |
13 | compileOptions {
14 | sourceCompatibility JavaVersion.VERSION_17
15 | targetCompatibility JavaVersion.VERSION_17
16 | }
17 |
18 | defaultConfig {
19 | applicationId "com.mapbox.navigation.examples.androidauto"
20 | minSdkVersion 23
21 | targetSdkVersion 33
22 | versionCode gitNumberOfCommits
23 | versionName gitTagDescription
24 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
25 | testInstrumentationRunnerArguments clearPackageData: 'true'
26 | vectorDrawables.useSupportLibrary = true
27 | }
28 |
29 | testOptions {
30 | execution 'ANDROIDX_TEST_ORCHESTRATOR'
31 | }
32 |
33 | buildTypes {
34 | debug {
35 | testCoverageEnabled = false
36 | manifestPlaceholders = [enableCrashReporting: "false"]
37 | }
38 | release {
39 | minifyEnabled true
40 | manifestPlaceholders = [enableCrashReporting: "true"]
41 | }
42 | }
43 |
44 | lintOptions {
45 | abortOnError false
46 | }
47 |
48 | buildFeatures {
49 | viewBinding true
50 | }
51 | }
52 |
53 | dependencies {
54 | implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
55 | implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
56 | implementation("androidx.appcompat:appcompat:1.5.1")
57 |
58 | // Mapbox Navigation Android Auto SDK Developer Preview
59 | implementation("com.mapbox.navigation:ui-androidauto:0.18.1")
60 | implementation("com.mapbox.navigation:ui-dropin:2.9.5")
61 | }
62 |
--------------------------------------------------------------------------------
/android-automotive-app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-parcelize'
4 | apply plugin: 'kotlin-kapt'
5 | apply plugin: 'com.mapbox.maps.token'
6 | apply from: "${rootDir}/gradle/script-git-version.gradle"
7 | apply from: "${rootDir}/gradle/ktlint.gradle"
8 |
9 | android {
10 | namespace "com.mapbox.navigation.examples.aaos"
11 | compileSdkVersion 33
12 |
13 | compileOptions {
14 | sourceCompatibility JavaVersion.VERSION_17
15 | targetCompatibility JavaVersion.VERSION_17
16 | }
17 |
18 | defaultConfig {
19 | applicationId "com.mapbox.navigation.examples.aaos"
20 | minSdkVersion 29
21 | targetSdkVersion 33
22 | versionCode gitNumberOfCommits
23 | versionName gitTagDescription
24 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
25 | testInstrumentationRunnerArguments clearPackageData: 'true'
26 | vectorDrawables.useSupportLibrary = true
27 | }
28 |
29 | testOptions {
30 | execution 'ANDROIDX_TEST_ORCHESTRATOR'
31 | }
32 |
33 | buildTypes {
34 | debug {
35 | testCoverageEnabled = false
36 | manifestPlaceholders = [enableCrashReporting: "false"]
37 | }
38 | release {
39 | minifyEnabled true
40 | manifestPlaceholders = [enableCrashReporting: "true"]
41 | }
42 | }
43 |
44 | lintOptions {
45 | abortOnError false
46 | }
47 |
48 | buildFeatures {
49 | viewBinding true
50 | }
51 | }
52 |
53 | dependencies {
54 | // Mapbox Navigation Android Auto SDK
55 | implementation("com.mapbox.navigation:ui-androidauto:0.22.0")
56 |
57 | // Android Automotive library
58 | // https://developer.android.com/jetpack/androidx/releases/car-app
59 | // implementation("androidx.car.app:app:1.4.0-rc02")
60 | // implementation("androidx.car.app:app-automotive:1.4.0-rc02")
61 | implementation("androidx.car.app:app:1.2.0")
62 | implementation("androidx.car.app:app-automotive:1.2.0")
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/status/ShowStatusActivity.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.standalone.status
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 | import com.mapbox.maps.Style
6 | import com.mapbox.maps.plugin.gestures.OnMapClickListener
7 | import com.mapbox.maps.plugin.gestures.gestures
8 | import com.mapbox.maps.plugin.scalebar.scalebar
9 | import com.mapbox.navigation.base.ExperimentalMapboxNavigationAPI
10 | import com.mapbox.navigation.examples.databinding.MapboxActivityShowStatusBinding
11 | import com.mapbox.navigation.ui.components.status.model.Status
12 | import com.mapbox.navigation.ui.components.status.model.StatusFactory
13 | import com.mapbox.navigation.ui.components.status.view.MapboxStatusView
14 |
15 | /**
16 | * In this example you can learn how to use [MapboxStatusView] to show a [Status] message
17 | * after tapping anywhere on the map.
18 | */
19 | @OptIn(ExperimentalMapboxNavigationAPI::class)
20 | class ShowStatusActivity : AppCompatActivity() {
21 |
22 | private lateinit var binding: MapboxActivityShowStatusBinding
23 |
24 | override fun onCreate(savedInstanceState: Bundle?) {
25 | super.onCreate(savedInstanceState)
26 | binding = MapboxActivityShowStatusBinding.inflate(layoutInflater)
27 | setContentView(binding.root)
28 |
29 | binding.mapView.apply {
30 | scalebar.enabled = false
31 | gestures.addOnMapClickListener(onMapClickListener)
32 | mapboxMap.loadStyle(Style.MAPBOX_STREETS)
33 | }
34 | }
35 |
36 | private fun showStatusMessage() {
37 | val status = StatusFactory.buildStatus(
38 | message = "Voice instructions OFF",
39 | duration = 2000,
40 | icon = com.mapbox.navigation.ui.components.R.drawable.mapbox_ic_sound_off
41 | )
42 | binding.statusView.render(status)
43 | }
44 |
45 | private val onMapClickListener = OnMapClickListener {
46 | // show status message on map click
47 | showStatusMessage()
48 | false
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/voice/res/layout/mapbox_activity_play_voice_instruction.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
34 |
35 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/HistoryFileLoader.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.standalone.replay
2 |
3 | import android.annotation.SuppressLint
4 | import android.content.Context
5 | import com.mapbox.navigation.core.history.MapboxHistoryReader
6 | import com.mapbox.navigation.core.replay.history.ReplayEventBase
7 | import com.mapbox.navigation.core.replay.history.ReplayHistoryMapper
8 | import com.mapbox.navigation.core.replay.history.ReplaySetNavigationRoute
9 | import com.mapbox.navigation.examples.R
10 | import kotlinx.coroutines.Dispatchers
11 | import kotlinx.coroutines.withContext
12 |
13 | class HistoryFileLoader {
14 | private val replayHistoryMapper = ReplayHistoryMapper.Builder().setRouteMapper {
15 | ReplaySetNavigationRoute.Builder(eventTimestamp = it.eventTimestamp)
16 | .route(it.navigationRoute)
17 | .build()
18 | }.build()
19 |
20 | @SuppressLint("MissingPermission")
21 | suspend fun loadReplayHistory(
22 | context: Context
23 | ): List = withContext(Dispatchers.IO) {
24 | loadSelectedHistory() ?: loadDefaultReplayHistory(context)
25 | }
26 |
27 | private suspend fun loadSelectedHistory(): List? =
28 | withContext(Dispatchers.IO) {
29 | HistoryFilesActivity.selectedHistory?.asSequence()?.mapNotNull { historyEvent ->
30 | replayHistoryMapper.mapToReplayEvent(historyEvent)
31 | }?.toList()
32 | }
33 |
34 | private suspend fun loadDefaultReplayHistory(
35 | context: Context
36 | ): List = withContext(Dispatchers.IO) {
37 | val fileName = "replay-history-activity.json"
38 | val inputStream = context.resources.openRawResource(R.raw.replay_history_activity)
39 | val outputFile = HistoryFilesDirectory.outputFile(context, fileName)
40 | outputFile.outputStream().use { fileOut ->
41 | inputStream.copyTo(fileOut)
42 | }
43 | MapboxHistoryReader(outputFile.absolutePath)
44 | .asSequence()
45 | .mapNotNull { replayHistoryMapper.mapToReplayEvent(it) }
46 | .toList()
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | If you have a usage question pertaining to the Mapbox Navigation SDK for Android, or any of our other products, contact us through [our support page](https://www.mapbox.com/contact/).
4 |
5 | If you want to contribute code:
6 |
7 | 1. Ensure that existing [pull requests](https://github.com/mapbox/mapbox-navigation-android-examples/pulls) and [issues](https://github.com/mapbox/mapbox-navigation-android-examples/issues) don’t already cover your contribution or question.
8 | 2. Pull requests are gladly accepted.
9 | 3. Mapbox uses `ktlint` to enforce good code standards. Make sure to read the codestyle setup. CI will fail if your PR contains any mistakes.
10 |
11 | ## Configuring [Ktlint](https://github.com/pinterest/ktlint) setup
12 |
13 | 1. On Mac OS or Linux: _brew install ktlint_
14 | 2. Inside Project's root directory: _ktlint --android applyToIDEAProject_
15 | (current root directories is _mapbox-navigation-android-examples_)
16 |
17 | ### Gradle tasks
18 | - _./gradlew ktlint_ - run ktlint to check code-style
19 | - _./gradlew ktlintFormat_ - run ktlint and try to fix code-style issues. Return non-0 if cannot fix all issues
20 |
21 | ## Adding new example
22 |
23 | Each example must be self contained. All source and resource files must be placed in a single package.
24 |
25 | To add new example:
26 |
27 | 1. Create new package with `res` folder in `app/src/main/java/com/mapbox/navigation/examples/`
28 |
29 | ```
30 | mapbox-navigation-android-examples/
31 | app/
32 | src/main/
33 | java/com/mapbox/navigation/examples/
34 | myexample/
35 | res/
36 | layout/
37 | mapbox_activity_myexample.xml
38 | values/
39 | colors.xml
40 | strings.xml
41 | styles.xml
42 | MyExampleActivity.kt
43 | ```
44 | 2. Sync project with Gradle files to ensure new resource folder is registered with `main` source set.
45 | 3. Create new Activity and add its entry to `app/src/main/java/com/mapbox/navigation/examples/ExamplesList.kt`
46 |
47 | Include short name, description and a screenshot (570x362).
48 | > Don't forget to register your activity in AndroidManifest.xml
49 |
50 |
51 |
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/copilot/CopilotViewModel.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.preview.copilot
2 |
3 | import androidx.lifecycle.ViewModel
4 | import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
5 | import com.mapbox.navigation.copilot.MapboxCopilot
6 | import com.mapbox.navigation.core.MapboxNavigation
7 | import com.mapbox.navigation.core.lifecycle.MapboxNavigationObserver
8 |
9 | /**
10 | * [ViewModel] is used in [CopilotActivity] to handle [MapboxCopilot]'s lifecycle by
11 | * managing when to call the [MapboxCopilot.start] / [MapboxCopilot.stop] API endpoints.
12 | *
13 | * Copilot is a [MapboxNavigationObserver], so it's tied to the [MapboxNavigation] lifecycle automatically.
14 | *
15 | * Copilot is an opt-in feature (see [MapboxCopilot.start] and [MapboxCopilot.stop]), which means you
16 | * have the choice to enable it for your users (drivers). Depending on the use case, you can enable Copilot
17 | * for either all drivers (for example, during a pilot) or a subset of them.
18 | *
19 | * We recommend connecting [MapboxCopilot.start] and [MapboxCopilot.stop] APIs to your app's lifecycle.
20 | *
21 | * WARNING: Mapbox Copilot is currently in public-preview. Copilot-related entities and APIs are currently marked
22 | * as [ExperimentalPreviewMapboxNavigationAPI] and subject to change.
23 | * These markings will be removed when the feature is generally available.
24 | *
25 | * Copilot is a library included in the Navigation SDK that processes full-trip-trace longitude and
26 | * latitude data ("**Copilot**"). Copilot is turned off by default, and can be enabled by you at the
27 | * application-developer level to improve feedback resolution. If you enable Copilot, your organization is responsible
28 | * for obtaining and maintaining all necessary consents and permissions, including providing notice to and obtaining your end
29 | * users' affirmative, expressed consent before any access or use of Copilot.
30 | */
31 |
32 | @OptIn(ExperimentalPreviewMapboxNavigationAPI::class)
33 | class CopilotViewModel : ViewModel() {
34 |
35 | init {
36 | MapboxCopilot.start()
37 | }
38 |
39 | override fun onCleared() {
40 | MapboxCopilot.stop()
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/android-automotive-app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
36 |
37 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/speedlimit/res/layout/mapbox_activity_show_speed_limit.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
33 |
34 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/tripprogress/res/layout/mapbox_activity_trip_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
33 |
34 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/routeline/res/layout/mapbox_activity_route_line.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
32 |
33 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/kotlin/com/mapbox/navigation/examples/feedbackagent/voicefeedback/domain/ASRState.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.feedbackagent.voicefeedback.domain
2 |
3 | import kotlin.time.ExperimentalTime
4 | import kotlin.time.TimeSource
5 |
6 | internal sealed interface ASRState {
7 |
8 | /**
9 | * Indicates that the ASR engine is idle and not actively listening or processing audio.
10 | */
11 | object Idle : ASRState
12 |
13 | /**
14 | * Indicates that the ASR engine is currently listening to the user's speech.
15 | *
16 | * @param text The partial or live transcription of the spoken input.
17 | */
18 | data class Listening(val text: String) : ASRState {
19 |
20 | /**
21 | * Timestamp indicating when the listening state was detected. This is used to measure the
22 | * durations where text is not changing.
23 | */
24 | @OptIn(ExperimentalTime::class)
25 | val timeMark: TimeSource.Monotonic.ValueTimeMark = TimeSource.Monotonic.markNow()
26 | }
27 |
28 | /**
29 | * Indicates that an error has occurred during the speech recognition process.
30 | *
31 | * @param error A [Throwable] describing the cause of the failure.
32 | */
33 | data class Error(val error: Throwable) : ASRState
34 |
35 | /**
36 | * Indicates that the user has finished speaking and the engine is
37 | * now waiting for the final recognition result.
38 | */
39 | object SpeechFinishedWaitingForResult : ASRState
40 |
41 | /**
42 | * Indicates that the final recognition result is available.
43 | *
44 | * @param text The recognized speech converted into text.
45 | */
46 | data class Result(
47 | val text: String,
48 | val feedbackType: String,
49 | ) : ASRState
50 |
51 | /**
52 | * Indicates that no recognizable speech was detected during the session.
53 | */
54 | object NoResult : ASRState
55 |
56 | /**
57 | * Indicates that the recognition was interrupted unexpectedly
58 | * (e.g., by external factors such as app lifecycle events).
59 | */
60 | object Interrupted : ASRState
61 |
62 | /**
63 | * Indicates that the recognition session was interrupted due to a timeout.
64 | */
65 | object InterruptedByTimeout : ASRState
66 | }
67 |
--------------------------------------------------------------------------------
/android-auto-app/src/main/java/com/mapbox/navigation/examples/androidauto/ReplayRouteTripSession.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.androidauto
2 |
3 | import android.annotation.SuppressLint
4 | import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
5 | import com.mapbox.navigation.core.MapboxNavigation
6 | import com.mapbox.navigation.core.directions.session.RoutesObserver
7 | import com.mapbox.navigation.core.lifecycle.MapboxNavigationObserver
8 | import com.mapbox.navigation.core.replay.route.ReplayProgressObserver
9 |
10 | // TODO This will be deleted in favor of a public api
11 | @OptIn(ExperimentalPreviewMapboxNavigationAPI::class)
12 | object ReplayRouteTripSession : MapboxNavigationObserver {
13 | private var replayProgressObserver: ReplayProgressObserver? = null
14 | private var routesObserver: RoutesObserver? = null
15 |
16 | @SuppressLint("MissingPermission")
17 | override fun onAttached(mapboxNavigation: MapboxNavigation) {
18 | mapboxNavigation.stopTripSession()
19 | mapboxNavigation.startReplayTripSession()
20 | val context = mapboxNavigation.navigationOptions.applicationContext
21 | val mapboxReplayer = mapboxNavigation.mapboxReplayer
22 |
23 | routesObserver = RoutesObserver { result ->
24 | if (result.navigationRoutes.isEmpty()) {
25 | mapboxReplayer.clearEvents()
26 | mapboxNavigation.resetTripSession()
27 | mapboxReplayer.pushRealLocation(context, 0.0)
28 | mapboxReplayer.play()
29 | }
30 | }.also { mapboxNavigation.registerRoutesObserver(it) }
31 |
32 | replayProgressObserver = ReplayProgressObserver(mapboxNavigation.mapboxReplayer)
33 | .also { mapboxNavigation.registerRouteProgressObserver(it) }
34 |
35 | mapboxReplayer.pushRealLocation(context, 0.0)
36 | mapboxReplayer.playbackSpeed(1.5)
37 | mapboxReplayer.play()
38 | }
39 |
40 | override fun onDetached(mapboxNavigation: MapboxNavigation) {
41 | replayProgressObserver?.let { mapboxNavigation.unregisterRouteProgressObserver(it) }
42 | routesObserver?.let { mapboxNavigation.unregisterRoutesObserver(it) }
43 | mapboxNavigation.mapboxReplayer.stop()
44 | mapboxNavigation.mapboxReplayer.clearEvents()
45 | mapboxNavigation.stopTripSession()
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/waypoints/res/layout/mapbox_activity_multiple_waypoints.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
26 |
27 |
32 |
33 |
38 |
39 |
44 |
45 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/maneuvers/res/layout/mapbox_activity_show_maneuver_instructions.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
34 |
35 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/res/layout/history_files_activity.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
22 |
23 |
29 |
30 |
31 |
32 |
33 |
42 |
43 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/kotlin/com/mapbox/navigation/examples/feedbackagent/voicefeedback/domain/VoiceFeedbackContextDTO.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.feedbackagent.voicefeedback.domain
2 |
3 | import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
4 | import kotlinx.serialization.SerialName
5 | import kotlinx.serialization.Serializable
6 |
7 | /**
8 | * Context required for Voice Feedback service to process the request.
9 | *
10 | * @property userContext required app context
11 | * @property appContext optional user context
12 | */
13 | @Serializable
14 | @ExperimentalPreviewMapboxNavigationAPI
15 | internal data class VoiceFeedbackContextDTO(
16 | @SerialName("user_context")
17 | val userContext: VoiceFeedbackUserContextDTO,
18 | @SerialName("app_context")
19 | val appContext: VoiceFeedbackAppContextDTO? = null,
20 | )
21 |
22 | /**
23 | * @property locale IETF language tag (based on ISO 639), for example "en-US".
24 | * This locale will be used to influence the language the AI replies in.
25 | */
26 | @Serializable
27 | @ExperimentalPreviewMapboxNavigationAPI
28 | internal data class VoiceFeedbackAppContextDTO(
29 | @SerialName("locale")
30 | val locale: String? = null,
31 | )
32 |
33 | /**
34 | * @property lat Latitude of the current location.
35 | * @property lon Longitude of the current location.
36 | * @property placeName The name of the place where the user currently is. For example:
37 | * - Neighborhood, a colloquial sub-city features often referred to in local parlance.
38 | * - Place, a cities, villages, municipalities, etc.
39 | * - Locality, a sub-city features present in countries where such an additional administrative layer is used in
40 | * postal addressing.
41 | * - District, smaller than top-level administrative features but typically larger than cities.
42 | * - Region, a top-level sub-national administrative features, such as states in the United States or provinces in
43 | * Canada or China.
44 | * - Country, Generally recognized countries or, in some cases like Hong Kong, an area of quasi-national administrative
45 | * status that has been given a designated country code under ISO 3166-1.
46 | *
47 | * The provided name should be the most granular available to be determined (for example, a Neighborhood should be
48 | * preferred over Place, if available).
49 | */
50 | @Serializable
51 | @ExperimentalPreviewMapboxNavigationAPI
52 | internal data class VoiceFeedbackUserContextDTO(
53 | val lat: String,
54 | val lon: String,
55 | @SerialName("place_name")
56 | val placeName: String,
57 | )
58 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Mapbox Navigation Android SDK Examples
2 |
3 | The repository is a collection of examples showing off the [Mapbox Navigation Android SDK](https://github.com/mapbox/mapbox-navigation-android). In order to support minSdkVersion 21, Android Auto and preview features, there are three example apps.
4 |
5 | 1. [app](app) minSdkVersion of 21
6 | 2. [app-preview](app-preview) minSdkVersion of 21
7 | 2. [android-auto-app](android-auto-app) minSdkVersion of 23
8 |
9 |
10 |

11 |
12 |
13 | ## Installation
14 |
15 | Make sure you follow the steps under the [Installation](https://docs.mapbox.com/android/navigation/guides/installation/) guide. Once you have your **public and secret access tokens ready**, do the following:
16 |
17 | ### [app](app)
18 |
19 | 1. `git clone git@github.com:mapbox/mapbox-navigation-android-examples.git`
20 | 2. Go to `app/src/main/res/values`
21 | 3. Look for `mapbox_access_token.xml`
22 | 4. If the file already exists, swap `YOUR_ACCESS_TOKEN_HERE` with your public access token.
23 | 5. If the file doesn't exist then create one and add the following content to it
24 | ```
25 |
26 |
27 | YOUR_ACCESS_TOKEN_HERE
28 |
29 | ```
30 | 6. Ensure that your secret token is added to [build.gradle](./build.gradle) or to global `gradle.properties` as described in the installation guide.
31 | 7. Run the examples under `app`.
32 |
33 | ## Previous versions
34 |
35 | If you're looking for code examples from previous versions of the Navigation SDK, you can access them through the following links:
36 | - [Navigation SDK v2](https://docs.mapbox.com/android/navigation/v2/guides/): https://github.com/mapbox/mapbox-navigation-android-examples/tree/main-v2
37 | - [Navigation SDK v1](https://docs.mapbox.com/android/legacy/navigation/guides/): https://github.com/mapbox/mapbox-navigation-android/tree/v1.6.0/examples/
38 |
39 | ## Getting Help
40 |
41 | - **Have a bug to report?** [Open an issue](https://github.com/mapbox/mapbox-navigation-android-examples/issues). If possible, include the version of Mapbox Navigation SDK, and an example that shows the issue.
42 | - **Have an example request?** [Open an issue](https://github.com/mapbox/mapbox-navigation-android-examples/issues/). Tell us what the example should do and why you want it.
43 |
44 | ## Contributing
45 |
46 | We welcome feedback and code contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
47 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/camera/res/layout/mapbox_activity_camera_transitions.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
16 |
17 |
24 |
25 |
31 |
32 |
39 |
40 |
41 |
42 |
56 |
57 |
--------------------------------------------------------------------------------
/app-preview/src/main/res/layout/mapbox_item_view_recycler.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
25 |
26 |
40 |
41 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/mapbox_item_view_recycler.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
25 |
26 |
40 |
41 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | version: 2.1
2 |
3 | #-------------------------------
4 | #---------- EXECUTORS ----------
5 | #-------------------------------
6 | executors:
7 | default-executor:
8 | docker:
9 | - image: mbgl/android-ndk-r22-jdk17-ubuntu24:latest
10 | working_directory: ~/code
11 | resource_class: medium+
12 |
13 | #-------------------------------
14 | #---------- WORKFLOWS ----------
15 | #-------------------------------
16 |
17 | workflows:
18 | version: 2
19 | default:
20 | jobs:
21 | - prepare-and-assemble
22 | - static-analysis:
23 | requires:
24 | - prepare-and-assemble
25 |
26 | #------------------------------
27 | #---------- COMMANDS ----------
28 | #------------------------------
29 | commands:
30 | write-workspace:
31 | steps:
32 | - persist_to_workspace:
33 | root: ~/code
34 | paths:
35 | - ./
36 |
37 | read-workspace:
38 | steps:
39 | - attach_workspace:
40 | at: ~/code
41 |
42 | restore-gradle-cache:
43 | steps:
44 | - restore_cache:
45 | keys:
46 | - deps-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
47 | - deps-
48 | - run:
49 | name: Download Dependencies
50 | command: ./gradlew androidDependencies
51 | - save_cache:
52 | paths:
53 | - ~/.gradle
54 | key: deps-{{ checksum "build.gradle" }}-{{ checksum "app/build.gradle" }}
55 |
56 | verify-codebase:
57 | steps:
58 | - run:
59 | name: Check codebase
60 | command: ./gradlew ktlint
61 |
62 | assemble-app:
63 | parameters:
64 | variant:
65 | description: Debug or Release
66 | type: string
67 | inject_token:
68 | description: whether to inject an access token file
69 | type: boolean
70 | default: false
71 | steps:
72 | - run:
73 | name: Assemble examples APK in << parameters.variant >> mode
74 | command: |
75 | if << parameters.inject_token >>; then
76 | echo "${MAPBOX_DEVELOPER_CONFIG}" > /root/code/app/src/main/res/values/mapbox_access_token.xml
77 | fi
78 | ./gradlew assemble<< parameters.variant >>
79 |
80 | #--------------------------
81 | #---------- JOBS ----------
82 | #--------------------------
83 |
84 | jobs:
85 | prepare-and-assemble:
86 | executor: default-executor
87 | steps:
88 | - checkout
89 | - restore-gradle-cache
90 | - assemble-app:
91 | variant: "Debug"
92 | - write-workspace
93 |
94 | static-analysis:
95 | executor: default-executor
96 | steps:
97 | - read-workspace
98 | - verify-codebase
--------------------------------------------------------------------------------
/android-automotive-app/src/main/java/com/mapbox/navigation/examples/aaos/car/CarTripSessionManager.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.aaos.car
2 |
3 | import android.annotation.SuppressLint
4 | import android.util.Log
5 | import androidx.car.app.CarContext
6 | import com.mapbox.androidauto.MapboxCarContext
7 | import com.mapbox.androidauto.internal.logAndroidAuto
8 | import com.mapbox.androidauto.screenmanager.MapboxScreen
9 | import com.mapbox.androidauto.screenmanager.MapboxScreenManager
10 | import com.mapbox.navigation.core.MapboxNavigation
11 | import com.mapbox.navigation.ui.base.lifecycle.UIComponent
12 | import kotlinx.coroutines.flow.combine
13 | import kotlinx.coroutines.flow.filter
14 | import kotlinx.coroutines.flow.launchIn
15 | import kotlinx.coroutines.flow.onEach
16 | import kotlinx.coroutines.flow.take
17 |
18 | class CarTripSessionManager(
19 | private val mapboxCarContext: MapboxCarContext,
20 | private val carLocationPermissions: CarLocationPermissions,
21 | ) : UIComponent() {
22 |
23 | private var replayRouteTripSession: ReplayRouteTripSession? = null
24 |
25 | @SuppressLint("MissingPermission")
26 | override fun onAttached(mapboxNavigation: MapboxNavigation) {
27 | super.onAttached(mapboxNavigation)
28 |
29 | combine(
30 | carLocationPermissions.grantedState,
31 | mapboxCarContext.mapboxNavigationManager.autoDriveEnabledFlow,
32 | ) { locationPermissionGranted, autoDriveEnabled ->
33 | logAndroidAuto("CarStartTripSession $locationPermissionGranted $autoDriveEnabled")
34 | if (locationPermissionGranted) {
35 | if (autoDriveEnabled) {
36 | replayRouteTripSession?.onDetached(mapboxNavigation)
37 | replayRouteTripSession = ReplayRouteTripSession().apply {
38 | onAttached(mapboxNavigation)
39 | }
40 | } else {
41 | replayRouteTripSession?.onDetached(mapboxNavigation)
42 | replayRouteTripSession = null
43 | mapboxNavigation.startTripSession()
44 | }
45 | }
46 | }.launchIn(coroutineScope)
47 |
48 | carLocationPermissions.grantedState.filter { it }.take(1).onEach {
49 | Log.i(TAG, "Permissions granted go to FreeDrive")
50 | MapboxScreenManager.replaceTop(MapboxScreen.FREE_DRIVE)
51 | }.launchIn(coroutineScope)
52 | }
53 |
54 | override fun onDetached(mapboxNavigation: MapboxNavigation) {
55 | super.onDetached(mapboxNavigation)
56 | replayRouteTripSession?.onDetached(mapboxNavigation)
57 | }
58 |
59 | fun requestPermissions(carContext: CarContext) {
60 | carLocationPermissions.requestPermissions(carContext)
61 | }
62 |
63 | private companion object {
64 | private const val TAG = "CarTripSessionManager"
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/HistoryFileAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.standalone.replay
2 |
3 | import android.view.LayoutInflater
4 | import android.view.View
5 | import android.view.ViewGroup
6 | import android.widget.TextView
7 | import androidx.recyclerview.widget.RecyclerView
8 | import com.mapbox.navigation.examples.R
9 |
10 | typealias HistoryFileItemClicked = (ReplayPath) -> Unit
11 |
12 | private const val ITEM_VIEW_TYPE_HEADER = 1
13 | private const val ITEM_VIEW_TYPE_REPLAY_PATH = 2
14 |
15 | class HistoryFileAdapter : RecyclerView.Adapter() {
16 |
17 | var data: List = listOf()
18 | var itemClicked: HistoryFileItemClicked? = null
19 |
20 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
21 | return when (viewType) {
22 | ITEM_VIEW_TYPE_REPLAY_PATH -> {
23 | val view = LayoutInflater.from(parent.context)
24 | .inflate(R.layout.history_files_list_item, parent, false)
25 | HistoryFileViewHolder(view)
26 | }
27 | ITEM_VIEW_TYPE_HEADER -> {
28 | val view = LayoutInflater.from(parent.context)
29 | .inflate(R.layout.history_files_header, parent, false)
30 | HeaderViewHolder(view)
31 | }
32 | else -> throw IllegalArgumentException("Unexpected view type: $viewType")
33 | }
34 | }
35 |
36 | override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
37 | when (val dataValue = data[position]) {
38 | is ReplayPath -> {
39 | val historyHolder = holder as HistoryFileViewHolder
40 | historyHolder.textViewTop.text = dataValue.title
41 | historyHolder.textViewBottom.text = dataValue.description
42 | historyHolder.itemView.setOnClickListener {
43 | itemClicked?.invoke(dataValue)
44 | }
45 | }
46 | is Header -> {
47 | (holder as HeaderViewHolder).textView.text = dataValue.title
48 | }
49 | }
50 | }
51 |
52 | override fun getItemViewType(position: Int): Int {
53 | return when (data[position]) {
54 | is ReplayPath -> ITEM_VIEW_TYPE_REPLAY_PATH
55 | is Header -> ITEM_VIEW_TYPE_HEADER
56 | }
57 | }
58 |
59 | override fun getItemCount() = data.size
60 | }
61 |
62 | class HistoryFileViewHolder(topView: View) : RecyclerView.ViewHolder(topView) {
63 | val textViewTop: TextView = topView.findViewById(R.id.textViewTop)
64 | val textViewBottom: TextView = topView.findViewById(R.id.textViewBottom)
65 | }
66 |
67 | class HeaderViewHolder(topView: View) : RecyclerView.ViewHolder(topView) {
68 | val textView: TextView = topView.findViewById(R.id.titleTextView)
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/status/ShowCustomStatusActivity.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.standalone.status
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 | import com.mapbox.maps.Style.Companion.MAPBOX_STREETS
6 | import com.mapbox.maps.plugin.gestures.OnMapClickListener
7 | import com.mapbox.maps.plugin.gestures.gestures
8 | import com.mapbox.maps.plugin.scalebar.scalebar
9 | import com.mapbox.navigation.base.ExperimentalMapboxNavigationAPI
10 | import com.mapbox.navigation.examples.databinding.MapboxActivityShowCustomStatusBinding
11 | import com.mapbox.navigation.ui.components.status.model.StatusFactory.buildStatus
12 | import com.mapbox.navigation.ui.components.status.view.MapboxStatusView
13 | import javax.net.ssl.SSLEngineResult.Status
14 |
15 | /**
16 | * In this example you can learn how to customize [MapboxStatusView] and use it to show
17 | * different types of [Status] messages.
18 | *
19 | * You can cycle through status messages by tapping anywhere on the map.
20 | */
21 | @OptIn(ExperimentalMapboxNavigationAPI::class)
22 | class ShowCustomStatusActivity : AppCompatActivity() {
23 |
24 | private lateinit var binding: MapboxActivityShowCustomStatusBinding
25 |
26 | override fun onCreate(savedInstanceState: Bundle?) {
27 | super.onCreate(savedInstanceState)
28 | binding = MapboxActivityShowCustomStatusBinding.inflate(layoutInflater)
29 | setContentView(binding.root)
30 |
31 | binding.mapView.apply {
32 | scalebar.enabled = false
33 | gestures.addOnMapClickListener(onMapClickListener)
34 | mapboxMap.loadStyle(MAPBOX_STREETS)
35 | }
36 | }
37 |
38 | private val statusMessages = mutableListOf(
39 | buildStatus(
40 | message = "Just text status",
41 | duration = 2000,
42 | ),
43 | buildStatus(
44 | message = "Status with text and a spinner",
45 | duration = 2000,
46 | spinner = true
47 | ),
48 | buildStatus(
49 | message = "Status with text and an icon",
50 | duration = 2000,
51 | icon = com.mapbox.navigation.ui.components.R.drawable.mapbox_ic_sound_off
52 | ),
53 | buildStatus(
54 | message = "Sticky status",
55 | duration = 0
56 | ),
57 | buildStatus(
58 | message = "Sticky status (without animation)",
59 | duration = 0,
60 | animated = false
61 | )
62 | )
63 |
64 | private fun nextStatusMessage() = statusMessages.removeFirst().also {
65 | // adding back to the queue
66 | statusMessages.add(it)
67 | }
68 |
69 | private val onMapClickListener = OnMapClickListener {
70 | // show next status message on map click
71 | binding.statusView.render(nextStatusMessage())
72 |
73 | false
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/feedback-agent-app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-parcelize'
4 | apply plugin: 'org.jetbrains.kotlin.plugin.serialization'
5 | apply plugin: 'com.mapbox.maps.token'
6 | apply from: "${rootDir}/gradle/script-git-version.gradle"
7 | apply from: "${rootDir}/gradle/ktlint.gradle"
8 |
9 | android {
10 | namespace = "com.mapbox.navigation.examples.feedbackagent"
11 | compileSdkVersion 34
12 |
13 | compileOptions {
14 | sourceCompatibility JavaVersion.VERSION_1_8
15 | targetCompatibility JavaVersion.VERSION_1_8
16 | }
17 |
18 | kotlinOptions {
19 | jvmTarget = "1.8"
20 | freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
21 | freeCompilerArgs += "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
22 | freeCompilerArgs += "-opt-in=com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI"
23 | }
24 |
25 | defaultConfig {
26 | applicationId "com.mapbox.navigation.examples.feedbackagent"
27 | minSdkVersion 21
28 | targetSdkVersion 34
29 | versionCode gitNumberOfCommits
30 | versionName gitTagDescription
31 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
32 | testInstrumentationRunnerArguments clearPackageData: 'true'
33 | vectorDrawables.useSupportLibrary = true
34 | }
35 |
36 | testOptions {
37 | execution 'ANDROIDX_TEST_ORCHESTRATOR'
38 | }
39 |
40 | buildTypes {
41 | debug {
42 | testCoverageEnabled = false
43 | manifestPlaceholders = [enableCrashReporting: "false"]
44 | }
45 | release {
46 | minifyEnabled true
47 | manifestPlaceholders = [enableCrashReporting: "true"]
48 | }
49 | }
50 |
51 | buildFeatures {
52 | compose true
53 | }
54 |
55 | composeOptions {
56 | kotlinCompilerExtensionVersion '1.4.7'
57 | }
58 |
59 | lintOptions {
60 | abortOnError false
61 | }
62 | }
63 |
64 | dependencies {
65 | implementation("com.mapbox.navigationcore:navigation:3.11.6")
66 | implementation("com.mapbox.navigationcore:core-mapgpt:3.11.6")
67 | implementation("com.mapbox.mapgpt.experimental:mapgpt:24.14.4")
68 |
69 | // Kotlin support
70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21"
71 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
72 | implementation "androidx.core:core-ktx:1.6.0"
73 | implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.4.0"
74 | implementation "androidx.activity:activity-compose:1.9.2"
75 | implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.1"
76 |
77 | // Compose BOM
78 | implementation platform('androidx.compose:compose-bom:2024.06.00')
79 | implementation 'androidx.compose.ui:ui-tooling-preview'
80 | implementation 'androidx.compose.material3:material3'
81 | debugImplementation 'androidx.compose.ui:ui-tooling'
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/HistoryFilesClient.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.standalone.replay
2 |
3 | import android.util.Log
4 | import com.mapbox.navigation.core.history.MapboxHistoryReader
5 | import kotlinx.coroutines.Dispatchers
6 | import kotlinx.coroutines.withContext
7 | import org.json.JSONArray
8 | import org.json.JSONObject
9 | import java.io.File
10 | import java.io.IOException
11 | import java.net.URL
12 |
13 | enum class ReplayDataSource {
14 | HTTP_SERVER,
15 | RAW_RES_DIRECTORY,
16 | FILE_DIRECTORY
17 | }
18 |
19 | private const val TAG = "HistoryFilesClient"
20 | private const val BASE_URL = "https://mapbox.github.io/mapbox-navigation-history/"
21 | private const val INDEX_JSON_URL = BASE_URL + "index.json"
22 | private const val HISTORY_FILE_URL = BASE_URL + "navigation-history/"
23 |
24 | /**
25 | * Helper class to retrieve history files stored in [BASE_URL] repo.
26 | */
27 | class HistoryFilesClient {
28 |
29 | /**
30 | * Requests history files kept in [BASE_URL] repo.
31 | *
32 | * @return list of [ReplayPath] objects corresponding to retrieved files.
33 | */
34 | suspend fun requestHistory(): List =
35 | withContext(Dispatchers.IO) {
36 | try {
37 | val result = URL(INDEX_JSON_URL).readText()
38 | val jsonArray = JSONArray(result)
39 | (0 until jsonArray.length()).map {
40 | (jsonArray.get(it) as JSONObject).run {
41 | ReplayPath(
42 | title = getString("title"),
43 | description = getString("description"),
44 | path = getString("path"),
45 | dataSource = ReplayDataSource.HTTP_SERVER
46 | )
47 | }
48 | }
49 | } catch (exception: IOException) {
50 | Log.e(TAG, "requestHistory onFailure: $exception")
51 | emptyList()
52 | }
53 | }
54 |
55 | /**
56 | * Requests a specific file kept in [BASE_URL] repo and writes its content to a file on disk.
57 | *
58 | * @param pathName name of the file to be requested
59 | * @param outputFile file on disk to store contents
60 | *
61 | * @return corresponding to retrieved contents [MapboxHistoryReader] object
62 | */
63 | suspend fun requestJsonFile(pathName: String, outputFile: File): MapboxHistoryReader? =
64 | withContext(Dispatchers.IO) {
65 | try {
66 | URL(HISTORY_FILE_URL + pathName).openStream().use { inputStream ->
67 | outputFile.outputStream().use { fileOut ->
68 | inputStream.copyTo(fileOut)
69 | }
70 | }
71 | MapboxHistoryReader(outputFile.absolutePath)
72 | } catch (exception: IOException) {
73 | Log.e(TAG, "requestJsonFile onFailure: $exception")
74 | null
75 | }
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%"=="" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%"=="" set DIRNAME=.
29 | @rem This is normally unused
30 | set APP_BASE_NAME=%~n0
31 | set APP_HOME=%DIRNAME%
32 |
33 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
34 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
35 |
36 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
37 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
38 |
39 | @rem Find java.exe
40 | if defined JAVA_HOME goto findJavaFromJavaHome
41 |
42 | set JAVA_EXE=java.exe
43 | %JAVA_EXE% -version >NUL 2>&1
44 | if %ERRORLEVEL% equ 0 goto execute
45 |
46 | echo.
47 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48 | echo.
49 | echo Please set the JAVA_HOME variable in your environment to match the
50 | echo location of your Java installation.
51 |
52 | goto fail
53 |
54 | :findJavaFromJavaHome
55 | set JAVA_HOME=%JAVA_HOME:"=%
56 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
57 |
58 | if exist "%JAVA_EXE%" goto execute
59 |
60 | echo.
61 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62 | echo.
63 | echo Please set the JAVA_HOME variable in your environment to match the
64 | echo location of your Java installation.
65 |
66 | goto fail
67 |
68 | :execute
69 | @rem Setup the command line
70 |
71 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
72 |
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if %ERRORLEVEL% equ 0 goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | set EXIT_CODE=%ERRORLEVEL%
85 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
86 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87 | exit /b %EXIT_CODE%
88 |
89 | :mainEnd
90 | if "%OS%"=="Windows_NT" endlocal
91 |
92 | :omega
93 |
--------------------------------------------------------------------------------
/app-preview/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'com.mapbox.maps.token'
4 | apply from: "${rootDir}/gradle/script-git-version.gradle"
5 | apply from: "${rootDir}/gradle/ktlint.gradle"
6 |
7 | android {
8 | namespace "com.mapbox.navigation.examples.preview"
9 | compileSdkVersion 33
10 |
11 | compileOptions {
12 | sourceCompatibility JavaVersion.VERSION_17
13 | targetCompatibility JavaVersion.VERSION_17
14 | }
15 |
16 | defaultConfig {
17 | applicationId "com.mapbox.navigation.examples.preview"
18 | minSdkVersion 21
19 | targetSdkVersion 33
20 | versionCode gitNumberOfCommits
21 | versionName gitTagDescription
22 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
23 | testInstrumentationRunnerArguments clearPackageData: 'true'
24 | vectorDrawables.useSupportLibrary = true
25 | }
26 |
27 | testOptions {
28 | execution 'ANDROIDX_TEST_ORCHESTRATOR'
29 | }
30 |
31 | buildTypes {
32 | debug {
33 | testCoverageEnabled = false
34 | manifestPlaceholders = [enableCrashReporting: "false"]
35 | }
36 | release {
37 | minifyEnabled true
38 | manifestPlaceholders = [enableCrashReporting: "true"]
39 | }
40 | }
41 |
42 | lintOptions {
43 | abortOnError false
44 | }
45 |
46 | buildFeatures {
47 | viewBinding true
48 | }
49 |
50 | sourceSets {
51 | main {
52 | def srcDirs = file("$projectDir/src/main/java/com/mapbox/navigation/examples/preview")
53 | .listFiles({ it.isDirectory() } as FileFilter)
54 | .collect { it.name }
55 |
56 | res.srcDirs = ['src/main/res']
57 | srcDirs.forEach {
58 | res.srcDirs += 'src/main/java/com/mapbox/navigation/examples/preview/' + it + '/res'
59 | }
60 | }
61 | }
62 | }
63 |
64 | dependencies {
65 | // Mapbox Navigation SDK
66 | implementation "com.mapbox.navigationcore:copilot:3.11.6"
67 | implementation "com.mapbox.navigationcore:android:3.11.6"
68 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.21"
69 | implementation "androidx.core:core-ktx:1.9.0"
70 | implementation "com.google.android.material:material:1.7.0"
71 | implementation "androidx.appcompat:appcompat:1.5.1"
72 | implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
73 | implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
74 | implementation "androidx.cardview:cardview:1.0.0"
75 | implementation "androidx.constraintlayout:constraintlayout:2.1.4"
76 | implementation "com.google.android.gms:play-services-location:20.0.0"
77 | implementation "com.squareup.leakcanary:leakcanary-android:2.9.1"
78 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
79 | implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3"
80 |
81 | testImplementation 'junit:junit:4.13.2'
82 | androidTestImplementation 'androidx.test.ext:junit:1.1.4'
83 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/app/src/main/java/com/mapbox/navigation/examples/standalone/replay/HistoryFilesActivity.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.standalone.replay
2 |
3 | import android.annotation.SuppressLint
4 | import android.os.Bundle
5 | import android.view.View
6 | import androidx.appcompat.app.AppCompatActivity
7 | import androidx.lifecycle.lifecycleScope
8 | import androidx.recyclerview.widget.LinearLayoutManager
9 | import com.google.android.material.snackbar.Snackbar
10 | import com.mapbox.navigation.core.history.MapboxHistoryReader
11 | import com.mapbox.navigation.examples.R
12 | import com.mapbox.navigation.examples.databinding.HistoryFilesActivityBinding
13 |
14 | @SuppressLint("HardwareIds")
15 | class HistoryFilesActivity : AppCompatActivity() {
16 |
17 | companion object {
18 | const val REQUEST_CODE: Int = 123
19 | const val EXTRA_HISTORY_FILE_DIRECTORY = "EXTRA_HISTORY_FILE_DIRECTORY"
20 | var selectedHistory: MapboxHistoryReader? = null
21 | private set
22 | }
23 |
24 | private lateinit var filesViewController: HistoryFilesViewController
25 | private lateinit var binding: HistoryFilesActivityBinding
26 |
27 | override fun onCreate(savedInstanceState: Bundle?) {
28 | super.onCreate(savedInstanceState)
29 | binding = HistoryFilesActivityBinding.inflate(layoutInflater)
30 | setContentView(binding.root)
31 |
32 | binding.collapsingToolbar.apply {
33 | setExpandedTitleTextAppearance(R.style.ExpandedToolbarStyle)
34 | setCollapsedTitleTextAppearance(R.style.CollapsedToolbarStyle)
35 | }
36 |
37 | setSupportActionBar(binding.toolbar)
38 |
39 | val viewAdapter = HistoryFileAdapter()
40 | binding.recyclerView.apply {
41 | setHasFixedSize(true)
42 | layoutManager = LinearLayoutManager(this.context)
43 | adapter = viewAdapter
44 | }
45 |
46 | val historyFileDirectory = intent.extras?.getString(EXTRA_HISTORY_FILE_DIRECTORY)
47 | filesViewController = HistoryFilesViewController(historyFileDirectory, lifecycleScope)
48 | filesViewController.attach(this, viewAdapter) { historyDataResponse ->
49 | if (historyDataResponse == null) {
50 | Snackbar.make(
51 | binding.recyclerView,
52 | getString(R.string.history_failed_to_load_item),
53 | Snackbar.LENGTH_LONG
54 | ).show()
55 | } else {
56 | selectedHistory = historyDataResponse
57 | setResult(REQUEST_CODE)
58 | finish()
59 | }
60 | }
61 |
62 | requestFileList()
63 | binding.fab.setOnClickListener { requestFileList() }
64 | }
65 |
66 | private fun requestFileList() {
67 | binding.fab.visibility = View.GONE
68 | filesViewController.requestHistoryFiles(this) { connected ->
69 | if (!connected) {
70 | Snackbar.make(
71 | binding.recyclerView,
72 | getString(R.string.history_failed_to_load_list),
73 | Snackbar.LENGTH_LONG
74 | ).show()
75 | binding.fab.visibility = View.VISIBLE
76 | }
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/android-automotive-app/src/main/java/com/mapbox/navigation/examples/aaos/car/ReplayRouteTripSession.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.aaos.car
2 |
3 | import android.annotation.SuppressLint
4 | import com.mapbox.androidauto.internal.logAndroidAuto
5 | import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
6 | import com.mapbox.navigation.core.MapboxNavigation
7 | import com.mapbox.navigation.core.directions.session.RoutesObserver
8 | import com.mapbox.navigation.core.replay.route.ReplayProgressObserver
9 | import com.mapbox.navigation.ui.base.lifecycle.UIComponent
10 | import kotlinx.coroutines.delay
11 | import kotlinx.coroutines.launch
12 |
13 | @OptIn(ExperimentalPreviewMapboxNavigationAPI::class)
14 | internal class ReplayRouteTripSession : UIComponent() {
15 | private var replayProgressObserver: ReplayProgressObserver? = null
16 | private var routesObserver: RoutesObserver? = null
17 |
18 | @SuppressLint("MissingPermission")
19 | override fun onAttached(mapboxNavigation: MapboxNavigation) {
20 | super.onAttached(mapboxNavigation)
21 | logAndroidAuto("ReplayRouteTripSession onAttached")
22 | mapboxNavigation.stopTripSession()
23 | coroutineScope.launch {
24 | // When we stop a trip session, we need to wait for the android auto navigation manager.
25 | // androidx.car.app.navigation.NavigationManager will call
26 | // NavigationManagerCallback.onStopNavigation inside the
27 | // MapboxCarNavigationManager if NavigationManager navigationStopped() and
28 | // navigationStarted() are called too close together.
29 | // https://issuetracker.google.com/u/0/issues/243110168
30 | delay(500)
31 |
32 | mapboxNavigation.startReplayTripSession()
33 | val context = mapboxNavigation.navigationOptions.applicationContext
34 | val mapboxReplayer = mapboxNavigation.mapboxReplayer
35 |
36 | routesObserver = RoutesObserver { result ->
37 | logAndroidAuto("ReplayRouteTripSession ${result.navigationRoutes.size}")
38 | if (result.navigationRoutes.isEmpty()) {
39 | mapboxReplayer.clearEvents()
40 | mapboxNavigation.resetTripSession()
41 | mapboxReplayer.pushRealLocation(context, 0.0)
42 | mapboxReplayer.play()
43 | }
44 | }.also { mapboxNavigation.registerRoutesObserver(it) }
45 |
46 | replayProgressObserver = ReplayProgressObserver(mapboxNavigation.mapboxReplayer)
47 | .also { mapboxNavigation.registerRouteProgressObserver(it) }
48 |
49 | mapboxReplayer.pushRealLocation(context, 0.0)
50 | mapboxReplayer.play()
51 | }
52 | }
53 |
54 | override fun onDetached(mapboxNavigation: MapboxNavigation) {
55 | super.onDetached(mapboxNavigation)
56 | logAndroidAuto("ReplayRouteTripSession onDetached")
57 | replayProgressObserver?.let { mapboxNavigation.unregisterRouteProgressObserver(it) }
58 | routesObserver?.let { mapboxNavigation.unregisterRoutesObserver(it) }
59 | mapboxNavigation.mapboxReplayer.stop()
60 | mapboxNavigation.mapboxReplayer.clearEvents()
61 | mapboxNavigation.stopTripSession()
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/feedback-agent-app/src/main/kotlin/com/mapbox/navigation/examples/feedbackagent/voicefeedback/domain/VoiceFeedbackContextProvider.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.feedbackagent.voicefeedback.domain
2 |
3 | import com.mapbox.navigation.base.ExperimentalPreviewMapboxNavigationAPI
4 | import kotlinx.serialization.encodeToString
5 | import kotlinx.serialization.json.Json
6 |
7 | @ExperimentalPreviewMapboxNavigationAPI
8 | internal interface VoiceFeedbackContextProvider {
9 |
10 | /**
11 | * Retrieves the current Voice Feedback context.
12 | *
13 | * @return The current [VoiceFeedbackContextDTO], or `null` if no context is available.
14 | */
15 | fun getContext(): VoiceFeedbackContextDTO?
16 |
17 | /**
18 | * Retrieves the current Voice Feedback JSON context.
19 | *
20 | * @return The current parsed [VoiceFeedbackContextDTO] String, or `null` if no context is available.
21 | */
22 | fun getJsonContext(): String?
23 | }
24 |
25 | /**
26 | * Stub implementation of VoiceFeedbackContextProvider for demonstration purposes.
27 | * This provides mock data that can be used for testing the voice feedback system.
28 | */
29 | @ExperimentalPreviewMapboxNavigationAPI
30 | internal class StubVoiceFeedbackContextProvider : VoiceFeedbackContextProvider {
31 |
32 | private val json = Json {
33 | prettyPrint = true
34 | ignoreUnknownKeys = true
35 | }
36 |
37 | // Allow customization of mock data
38 | private var currentContext: VoiceFeedbackContextDTO? = null
39 |
40 | override fun getContext(): VoiceFeedbackContextDTO? {
41 | return currentContext ?: createMockContext()
42 | }
43 |
44 | override fun getJsonContext(): String? {
45 | return try {
46 | val context = getContext()
47 | context?.let { json.encodeToString(it) }
48 | } catch (e: Exception) {
49 | null
50 | }
51 | }
52 |
53 | /**
54 | * Sets a custom context for testing purposes.
55 | * If null, will fall back to the default mock context.
56 | */
57 | fun setContext(context: VoiceFeedbackContextDTO?) {
58 | currentContext = context
59 | }
60 |
61 | /**
62 | * Clears any custom context and returns to default mock data.
63 | */
64 | fun resetToDefaultContext() {
65 | currentContext = null
66 | }
67 |
68 | /**
69 | * Updates the current user location in the context.
70 | */
71 | fun updateUserLocation(lat: String, lon: String, placeName: String) {
72 | val current = currentContext ?: createMockContext()
73 | currentContext = current.copy(
74 | userContext = current.userContext.copy(
75 | lat = lat,
76 | lon = lon,
77 | placeName = placeName,
78 | )
79 | )
80 | }
81 |
82 | private fun createMockContext(): VoiceFeedbackContextDTO {
83 | return VoiceFeedbackContextDTO(
84 | userContext = VoiceFeedbackUserContextDTO(
85 | lat = "37.7749",
86 | lon = "-122.4194",
87 | placeName = "San Francisco, California, United States"
88 | ),
89 | appContext = VoiceFeedbackAppContextDTO(
90 | locale = "en-US",
91 | ),
92 | )
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/app-preview/src/main/java/com/mapbox/navigation/examples/preview/copilot/res/layout/mapbox_activity_copilot.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
18 |
19 |
28 |
29 |
38 |
39 |
49 |
50 |
60 |
61 |
71 |
72 |
--------------------------------------------------------------------------------
/app/src/test/java/com/mapbox/navigation/examples/basics/WaypointsSetTest.kt:
--------------------------------------------------------------------------------
1 | package com.mapbox.navigation.examples.basics
2 |
3 | import com.mapbox.geojson.Point
4 | import org.junit.Assert.assertEquals
5 | import org.junit.Test
6 |
7 | class WaypointsSetTest {
8 | @Test
9 | fun `map not silent waypoints types to waypoint indices`() {
10 | val set = WaypointsSet().apply {
11 | addRegular(createPoint())
12 | addRegular(createPoint())
13 | addNamed(createPoint(), "test")
14 | }
15 |
16 | val indexes = set.waypointsIndices()
17 |
18 | assertEquals(listOf(0, 1, 2), indexes)
19 | }
20 |
21 | @Test
22 | fun `map silent waypoints to indices`() {
23 | val set = WaypointsSet().apply {
24 | addRegular(createPoint())
25 | addSilent(createPoint())
26 | addNamed(createPoint(), "test")
27 | }
28 |
29 | val indexes = set.waypointsIndices()
30 |
31 | assertEquals(listOf(0, 2), indexes)
32 | }
33 |
34 | @Test
35 | fun `map waypoints to names`() {
36 | val set = WaypointsSet().apply {
37 | addRegular(createPoint())
38 | addRegular(createPoint())
39 | addNamed(createPoint(), "test named")
40 | }
41 |
42 | val names = set.waypointsNames()
43 |
44 | assertEquals(listOf("", "", "test named"), names)
45 | }
46 |
47 | @Test
48 | fun `map regular, silent, and named waypoints to names`() {
49 | val set = WaypointsSet().apply {
50 | addRegular(createPoint())
51 | addSilent(createPoint())
52 | addNamed(createPoint(), "test named")
53 | }
54 |
55 | val names = set.waypointsNames()
56 |
57 | assertEquals(listOf("", "test named"), names)
58 | }
59 |
60 | @Test
61 | fun `map waypoints to points`() {
62 | val set = WaypointsSet().apply {
63 | addRegular(createPoint(lon = 1.0))
64 | addSilent(createPoint(lon = 2.0))
65 | addNamed(createPoint(lon = 3.0), "test")
66 | }
67 |
68 | val longitudes = set.coordinatesList().map { it.longitude() }
69 |
70 | assertEquals(listOf(1.0, 2.0, 3.0), longitudes)
71 | }
72 |
73 | @Test
74 | fun `last waypoint can't be silent`() {
75 | val set = WaypointsSet().apply {
76 | addRegular(createPoint())
77 | addSilent(createPoint())
78 | addSilent(createPoint())
79 | }
80 |
81 | val indices = set.waypointsIndices()
82 |
83 | assertEquals(listOf(0, 2), indices)
84 | }
85 |
86 | @Test
87 | fun `first waypoint can't be silent`() {
88 | val set = WaypointsSet().apply {
89 | addSilent(createPoint())
90 | addRegular(createPoint())
91 | addRegular(createPoint())
92 | }
93 |
94 | val indices = set.waypointsIndices()
95 |
96 | assertEquals(listOf(0, 1, 2), indices)
97 | }
98 |
99 | @Test
100 | fun `first and last silent waypoints have names`() {
101 | val set = WaypointsSet().apply {
102 | addSilent(createPoint())
103 | addNamed(createPoint(), "test")
104 | addSilent(createPoint())
105 | }
106 |
107 | val names = set.waypointsNames()
108 |
109 | assertEquals(listOf("", "test", ""), names)
110 | }
111 |
112 | private fun createPoint(lon: Double = 0.0) = Point.fromLngLat(lon, 0.0)
113 | }
114 |
--------------------------------------------------------------------------------