Class MapProviderRegistry
java.lang.Object
com.codename1.maps.spi.MapProviderRegistry
The registry through which build-injected MapProvider implementations
advertise themselves to the core NativeMap component.
Core never registers a provider itself. The build, when a maps.provider
hint selects one, injects the provider implementation into the app and
weaves a register(...) call into the generated startup code (the same way
optional features such as push messaging are wired in). With no provider
injected the registry is empty and NativeMap renders the vector fallback.
-
Method Summary
Modifier and TypeMethodDescriptionstatic MapProviderReturns the provider that should back a new native map by walking the configured fallback chain (preferred ids first, honoring avectorterminator), then any remaining available provider, ornullwhen none can render right now (the caller then uses the vector fallback).static booleanWhether any registered provider can render on this device right now.static voidregister(MapProvider provider) Registers a provider.static voidHints which single provider id to prefer (then any available).static voidsetProviderOrder(String[] ids) Sets the ordered provider fallback chain by id, e.g.
-
Method Details
-
register
Registers a provider. Called by build-injected startup code. Repeated registration of the same provider id replaces the earlier instance. -
setProviderOrder
Sets the ordered provider fallback chain by id, e.g.setProviderOrder("google", "huawei", "web")to try Google Maps, then Huawei Map Kit, then a web-SDK map, before the pure-vector fallback. The special ids"vector"/"none"terminate the chain (force the vector fallback even if a later provider is available). Any provider not named in a non-terminated chain is still used as a last resort if available. Build hints (maps.providers/ per-platform<platform>.maps.providers) set this at startup; call it from app code to override. -
setPreferredProvider
Hints which single provider id to prefer (then any available). Kept for convenience; equivalent to a one-element [#setProviderOrder(String[])]. -
getProvider
Returns the provider that should back a new native map by walking the configured fallback chain (preferred ids first, honoring avectorterminator), then any remaining available provider, ornullwhen none can render right now (the caller then uses the vector fallback). -
hasProvider
public static boolean hasProvider()Whether any registered provider can render on this device right now.
-