LocalizationConfig
Localization Configuration
The LocalizationConfig is a singleton object that provides centralized configuration for the MultiSet SDK localization behavior. It controls how the AR activities perform localization, including timing, quality, and feature settings.
Description
This configuration object allows you to customize the localization behavior before a query request is made. Settings include auto-localization triggers, background localization intervals, frame capture parameters, confidence thresholds, GPS integration, localization hints (to narrow the search for Map and MapSet localization), and UI feedback options. All settings can be modified at runtime and validated using the validate() method.
The AR activities read these values when localization starts, so any change you make to LocalizationConfig takes effect on the next query. The sample app also exposes an in-app Settings dialog that edits these same properties at runtime and persists them across launches.
Properties
This section details the publicly accessible fields of the LocalizationConfig that can be configured via script.
Localization Behavior
autoLocalize
Boolean
true
Whether to automatically start localization when the AR session begins. If false, the user must manually tap the capture/localize button.
backgroundLocalization
Boolean
true
Whether to continue localization in the background after the first success. Helps maintain accurate positioning over time.
backgroundLocalizationIntervalSeconds
Float
30f
The time interval in seconds between background localization attempts. Only used when backgroundLocalization is true. Valid range: 15 - 180 seconds.
relocalization
Boolean
true
Whether to enable relocalization when AR tracking is lost. Automatically triggers localization when the AR tracking state changes to PAUSED or STOPPED.
firstLocalizationUntilSuccess
Boolean
true
Keep trying until the first localization succeeds. If true, failed localizations will silently retry until one succeeds.
Multi-Frame Capture Settings
numberOfFrames
Int
4
The number of frames to capture for multi-frame localization. More frames = better accuracy but longer capture time. Valid range: 4 - 6 frames.
frameCaptureIntervalMs
Long
500L
The interval between frame captures in milliseconds. Allows user movement between frames for better coverage. Valid range: 100 - 1000 ms.
Confidence Settings
confidenceCheck
Boolean
true
Whether to check confidence threshold before accepting localization. If true, localizations with confidence below the threshold will be rejected.
confidenceThreshold
Float
0.3f
Minimum confidence score to accept a localization result. Only used when confidenceCheck is true. Valid range: 0.2 - 0.8 (matches the Unity SDK).
GPS Settings
enableGeoHint
Boolean
false
Whether to send GPS coordinates as a hint to improve localization. Requires location permission. Useful for outdoor or large-scale maps.
includeGeoCoordinatesInResponse
Boolean
false
Whether to include geo-coordinates in the localization response. Useful if you need the world position of localized objects.
Localization Hints
Localization hints let you constrain the search space before sending a query, which speeds up matching and reduces false positives in large maps or mapSets. All hints are optional — leave them empty/default to disable them.
hintMapCodes
List<String>
emptyList()
Subset of map codes within a mapSet to restrict localization to. Sent as repeated hintMapCodes fields. Only applies to mapSet localization; ignored for single map localization.
hintPosition
String
""
Approximate position hint in "x,y,z" format to narrow the search around a known location. Leave empty to disable.
hintFloorHeight
String
""
Floor/ceiling height constraint in "floor,ceiling" format, e.g. "0,5". Leave empty to disable.
hintRadius
Int
25
Search radius in meters for spatial filtering. Applied only when a geo hint (enableGeoHint) or hintPosition is present. Valid range: 1 - 100.
use2DFiltering
Boolean
false
When spatial filtering is active, skip altitude (Y-axis) and filter on horizontal distance (X/Z) only.
Note:
hintRadiusanduse2DFilteringare spatial filters that are only meaningful relative to a geo hint or a position hint. They are sent only whenenableGeoHint(with a valid GPS fix) orhintPositionis set — otherwise the server would filter out every candidate and report "Pose not found".
UI Settings
showAlerts
Boolean
true
Whether to show UI alerts (toasts) for localization status. Shows success/failure messages to the user.
enableMeshVisualization
Boolean
true
Whether to show 3D mesh overlay after successful localization. The mesh helps visualize the mapped environment.
Image Quality Settings
imageQuality
Int
90
JPEG quality for captured images sent to the localization API. Higher quality = better accuracy but larger upload size. Valid range: 50 - 100.
Methods
This section describes the publicly accessible methods of the LocalizationConfig.
resetToDefaults()
Resets all settings to their default values.
Declaration
Description
Calling this method will reset all configuration properties to their factory default values. This is useful when you want to ensure a clean configuration state before customizing specific settings.
Example
validate()
Applies validated bounds to all settings.
Declaration
Description
Calling this method will clamp all numeric settings to their valid ranges. This ensures that all configuration values are within acceptable bounds before they are used by the AR activities. It is recommended to call this method after modifying any settings.
Validation Rules:
backgroundLocalizationIntervalSeconds
15 - 180
numberOfFrames
4 - 6
frameCaptureIntervalMs
100 - 1000
confidenceThreshold
0.2 - 0.8
hintRadius
1 - 100
imageQuality
50 - 100
Example
Usage Examples
Basic Configuration
MapSet Localization with Hints
When localizing against a mapSet, you can narrow the search to a subset of maps and a known area before the query is sent:
Configuration Flow
Runtime Settings Dialog
The sample app lets you change the localization configuration at runtime, before starting a query — no rebuild required. Tap the settings gear on the landing screen (MainActivity) to open a full-screen SettingsDialogFragment that edits every LocalizationConfig (and ObjectTrackingConfig) property described above, including the localization hints.
Changes are written straight back to the
LocalizationConfigsingleton, so the next localization query uses the updated values.Settings are persisted with
ConfigStore(backed bySharedPreferences) and restored on the next app launch viaConfigStore.load(this)inMainActivity.onCreate().Credentials and map / mapSet / object codes are not persisted — they always come from
multiset.properties(BuildConfig).Save applies and stores the values; Reset restores defaults via
resetToDefaults().
You can achieve the same result programmatically by setting
LocalizationConfigproperties directly and callingvalidate()before launchingMultiSetLocalizationActivity— the Settings dialog is simply a UI over those same properties.
Best Practices
Always call
validate()after modifying settings to ensure values are within valid ranges.Call
resetToDefaults()before configuring if you want to start from a known state.Disable
firstLocalizationUntilSuccesswhen usingenableGeoHintandincludeGeoCoordinatesInResponsetogether, as geo-based failures should be reported to the user.Increase
numberOfFramesfor environments with sparse or repetitive features.Enable
backgroundLocalizationfor applications that need to maintain accurate positioning over time.Use higher
imageQualityfor complex environments but be mindful of network bandwidth.Use
hintMapCodesto restrict large mapSets to the maps the user is likely in — this speeds up matching and avoids cross-map false positives.Pair
hintRadius/use2DFilteringwith a hint (eitherenableGeoHintwith a GPS fix orhintPosition). On their own they have no reference point and the server will reject every candidate.
Related
Last updated
Was this helpful?

