Geolocation
Browser location via dioxus_sdk_geolocation — one-shot and live-watch patterns, both gated on button clicks. Each fix also updates the Browser geolocation slot in the shared store.
Geolocation demo uses the shared location store. Coordinates come from whichever provider is active (see Manage location).
No active location yet — open Manage location and refresh a provider.
SSG & hydration
Build / SSG: The server target has no geolocation API; init_geolocator stores Err(Unsupported) but this page does not print that in HTML — idle placeholders are static so hydration matches.
Browser: Neither one-shot nor watch runs until you click. Do not call geolocation in use_effect on mount unless you intentionally want a prompt during hydration.
Applies to the next one-shot request or when you Start watching (stop an active watch first to change mode mid-session).
One-shot fix (user gesture)
Calls getCurrentPosition on WASM (same underlying API as Geolocator::get_coordinates) and prints coords.accuracy — the SDK struct omits that field.
No location yet. Click Get my location — your browser should ask for permission.
Live updates (user gesture, opt-in)
Uses watchPosition with the same metadata as one-shot. Start only when you need updates; Stop calls clearWatch.
Watch is off — no background location polling. Click Start watching when you expect to move.
Tips
coords.accuracyis the estimated horizontal error radius in metres (from the browser fix), not confirmation thatenableHighAccuracywas honoured. Store the requested flag on each request (this demo does).dioxus-sdk-geolocationGeocoordinatesonly has lat/lon — useposition_apiin this file or extend the SDK to readaccuracy/altitude.dioxus-sdk-geolocationlistendoes not expose the browser watch id;position_api::stop_watchusesclearWatch.- HTTPS (or localhost) is required for geolocation in most browsers.