Instrument Cluster
Navigation SDK UX Framework comes with a built-in Instrument Cluster support for Android Automotive devices. You have to explicitly enable it when initializing the UX Framework:
Dash.init(
applicationContext = applicationContext,
accessToken = getString(R.string.mapbox_access_token)
) {
cluster {
enabled = true
}
}
The framework also includes an Android activity that can be rendered on the Instrument Cluster. To use the activity, it is enough to add the following dependency to your project:
// build.gradle.kts
dependencies {
implementation("com.mapbox.navigationux:cluster:1.0.0-beta.42.1")
}
Customization
If necessary, you can replace the map styles with your own through the configuration object like this:
Dash.init(
applicationContext = applicationContext,
accessToken = getString(R.string.mapbox_access_token)
) {
cluster {
enabled = true
dayStyleUri = <day_style_uri>
nightStyleUri = <night_style_uri>
satelliteStyleUri = <satellite_style_uri>
map3dStyleUri = <map_3D_style_uri>
}
}
If the prebuilt activity doesn't suit your needs, you can implement your own. The activity has to be marked with category android.car.cluster.NAVIGATION
:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.car.cluster.NAVIGATION" />
</intent-filter>
この{Type}は役に立ちましたか?