dioxus-sdk-geolocation

Crates.iodioxus-sdk-geolocation
lib.rsdioxus-sdk-geolocation
version0.7.0
created_at2025-11-06 21:44:19.000982+00
updated_at2025-11-06 21:44:19.000982+00
descriptionGeolocation utilities and hooks for Dioxus.
homepagehttps://dioxuslabs.com
repositoryhttps://github.com/DioxusLabs/sdk/
max_upload_size
id1920762
size74,264
Jonathan Kelley (jkelleyrtp)

documentation

README

Dioxus Geolocation

Geolocation utilities and hooks for Dioxus.

Supports

  • Web
  • Windows
  • Mac
  • Linux
  • Android
  • iOs

Usage

Add dioxus-sdk-geolocation to your Cargo.toml:

[dependencies]
dioxus-sdk-geolocation = "0.1"

Example:

use dioxus::prelude::*;
use dioxus_sdk_geolocation::{
    init_geolocator, use_geolocation, PowerMode
};

#[component]
fn App() -> Element {
    let geolocator = init_geolocator(PowerMode::High).unwrap();
    let coords = use_geolocation();

    match coords {
      Ok(coords) => {
        rsx!( p { "Latitude: {coords.latitude} | Longitude: {coords.longitude}" } )
      }
      Err(Error::NotInitialized) => {
        rsx!( p { "Initializing..." } )
      }
      Err(e) => {
        rsx!( p { "An error occurred {e}" } )
      }
    }
}
Commit count: 119

cargo fmt