What problem does it solve?
Provide reliable device location retrieval for .NET MAUI apps while avoiding hangs, excessive battery drain, and inconsistent platform behavior caused by missing timeouts, improper accuracy settings, or unhandled permission flows.
Core Features & Use Cases
- Cancellation and timeouts to prevent GetLocationAsync from hanging when GPS is unavailable or indoors.
- Accuracy vs. battery guidance to choose Lowest/Low/Medium/High/Best based on feature needs.
- One-shot and continuous location patterns with StartListening/StopListening and proper event unsubscription.
- Platform-specific permission and manifest guidance for Android, iOS, macOS, and Windows, including background location and iOS full-accuracy prompts.
- Security checks and fallbacks such as mock-location detection, treating Altitude 0.0 as unknown, and caching with GetLastKnownLocationAsync fallback.
- DI-friendly wrapper example to register IGeolocation and provide a GetCurrentAsync with sensible fallbacks.
Quick Start
Ask for a sample .NET MAUI method that fetches the current location with a CancellationToken timeout, requests runtime permissions, falls back to the last-known location if recent, and rejects mock-provider locations.