public final class MapProviderRegistry

  1. Object
  2. 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.

Methods

public static synchronized void register(MapProvider provider)Registers a provider.
public static synchronized void setProviderOrder(String[] ids)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.
public static synchronized void setPreferredProvider(String id)Hints which single provider id to prefer (then any available).
public static synchronized MapProvider getProvider()Returns the provider that should back a new native map by walking the configured fallback chain (preferred ids first, honoring a vector terminator), then any remaining available provider, or null when none can render right now (the caller then uses the vector fallback).
public static synchronized boolean hasProvider()Whether any registered provider can render on this device right now.

Inherited methods

Method details

register

public static synchronized void register(MapProvider provider)
Registers a provider. Called by build-injected startup code. Repeated registration of the same provider id replaces the earlier instance.

setProviderOrder

public static synchronized void setProviderOrder(String[] ids)
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

public static synchronized void setPreferredProvider(String id)
Hints which single provider id to prefer (then any available). Kept for convenience; equivalent to a one-element [#setProviderOrder(String[])].

getProvider

public static synchronized MapProvider getProvider()
Returns the provider that should back a new native map by walking the configured fallback chain (preferred ids first, honoring a vector terminator), then any remaining available provider, or null when none can render right now (the caller then uses the vector fallback).

hasProvider

public static synchronized boolean hasProvider()
Whether any registered provider can render on this device right now.