BlazorNative.Device 0.5.1

dotnet add package BlazorNative.Device --version 0.5.1
                    
NuGet\Install-Package BlazorNative.Device -Version 0.5.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlazorNative.Device" Version="0.5.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BlazorNative.Device" Version="0.5.1" />
                    
Directory.Packages.props
<PackageReference Include="BlazorNative.Device" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BlazorNative.Device --version 0.5.1
                    
#r "nuget: BlazorNative.Device, 0.5.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BlazorNative.Device@0.5.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BlazorNative.Device&version=0.5.1
                    
Install as a Cake Addin
#tool nuget:?package=BlazorNative.Device&version=0.5.1
                    
Install as a Cake Tool

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last Updated
0.5.1 30 7/23/2026
0.5.0 47 7/23/2026
0.4.1 81 7/21/2026
0.4.0 82 7/21/2026
0.3.0 88 7/20/2026
0.2.0 84 7/20/2026
0.1.1 88 7/20/2026
0.1.0 84 7/19/2026