provideRoadShieldIcon
fun provideRoadShieldIcon(reference: IconReference, content: String): Result<Bitmap, RoadShieldIconProviderFailure>
Generates a road shield image.
The reference parameter is used to access an asset for the base road shield image. If the reference cannot be resolved to a valid image asset, a fallback image is generated - a rounded rectangle with white background, black text and border.
A road shield reference can be obtained from GuidanceInstructions which are provided by navigation engine during the navigation session.
Example Usage
val provider = RoadShieldIconProvider(applicationContext)
val imageList = guidanceInstruction?.nextSignificantRoad?.shields?.map { roadShield ->
provider.provideRoadShieldIcon(
reference = roadShield.iconReference,
content = roadShield.shieldContent,
).value().toAndroidBitmap()
}.orEmpty()Content copied to clipboard
Return
Result containing the generated bitmap or failure information.
Parameters
reference
The reference of the base road shield image.
content
The text content to display on the shield (e.g., "I-95", "A4").