BlazorNative.Device
0.5.1
dotnet add package BlazorNative.Device --version 0.5.1
NuGet\Install-Package BlazorNative.Device -Version 0.5.1
<PackageReference Include="BlazorNative.Device" Version="0.5.1" />
<PackageVersion Include="BlazorNative.Device" Version="0.5.1" />
<PackageReference Include="BlazorNative.Device" />
paket add BlazorNative.Device --version 0.5.1
#r "nuget: BlazorNative.Device, 0.5.1"
#:package BlazorNative.Device@0.5.1
#addin nuget:?package=BlazorNative.Device&version=0.5.1
#tool nuget:?package=BlazorNative.Device&version=0.5.1
BlazorNative.Device
The BlazorNative device APIs: DI-injectable, ergonomic facades over the hosting native shell's permission-gated host-call bridge, so Blazor components use device capabilities on NativeAOT with denial delivered as data — never an exception, never a hang.
Geolocation
// DI (the runtime composition root wires this for you):
services.AddBlazorNativeDevice();
// In a component — inject the facade, not the low-level bridge:
[Inject] public IGeolocation Geo { get; set; } = default!;
async Task LocateAsync()
{
var result = await Geo.GetCurrentPositionAsync();
if (result.Status == GeolocationStatus.Granted && result.Position is { } p)
_text = $"{p.Latitude}, {p.Longitude}";
else
_text = result.Status.ToString(); // Denied / DeniedPermanently / Restricted / ...
}
A single GetCurrentPositionAsync runs the whole permission dance host-side
(check → prompt → obtain-a-fix / note-a-denial) and always resolves with a status
value. CheckPermissionAsync reads the current status without prompting, for a
UI that wants to show state before offering a "use my location" action.
Part of the BlazorNative framework. See the documentation for the full story.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- BlazorNative.Core (>= 0.5.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on BlazorNative.Device:
| Package | Downloads |
|---|---|
|
BlazorNative.Runtime
The BlazorNative runtime: the 10 blazornative_* native exports, the host session, the binary frame/bridge wire protocol, and the BlazorNativeApp.RegisterPages registration API through which an app names its pages. NativeAOT/trim-compatible — the app owns the publish head. |
GitHub repositories
This package is not used by any popular GitHub repositories.