IGeolocation
Namespace: BlazorNative.Device
DI-injectable façade over device location. Inject this rather than the
low-level BlazorNative.Core.IMobileBridge; IGeolocation.GetCurrentPositionAsync(CancellationToken) runs the
whole permission dance host-side and always resolves with a
BlazorNative.Core.GeolocationResult (a denial is DATA, never an exception or a hang),
while IGeolocation.CheckPermissionAsync(CancellationToken) reports the current permission without
prompting. Register it with
ServiceCollectionExtensions.AddBlazorNativeDevice(IServiceCollection).
public interface IGeolocation
Methods
GetCurrentPositionAsync(CancellationToken)
Requests-then-fetches the current position: runs the whole
permission dance host-side and returns a BlazorNative.Core.GeolocationResult
whose BlazorNative.Core.GeolocationResult.Status is the terminal outcome
(granted / denied / permanent / restricted / unavailable / error). A
non-Granted status carries a null position — denial is DATA. The
ct abandons a never-completing call (a process killed
during the prompt): the pending entry is dropped and the task cancels.
ValueTask<GeolocationResult> GetCurrentPositionAsync(CancellationToken ct = null)
Parameters
Returns
CheckPermissionAsync(CancellationToken)
Reads the current permission status WITHOUT prompting — for a UI that wants to show state before offering a "use my location" action.
ValueTask<GeolocationStatus> CheckPermissionAsync(CancellationToken ct = null)