Skip to main content

Basics

Use the Device modules from Wisej page and form event handlers. Both local and remote applications use the native client for these calls. Direct calls to MAUI or platform APIs from the Wisej project are a separate local-only approach.

Validating Client​

Check whether the current client is Hybrid before offering native functionality:

bool valid = Wisej.Hybrid.Device.Valid;

A Hybrid client does not establish support for every operation. Check Platform Capabilities and the selected module's availability properties.

Reading Device Information​

The direct Device modules expose information reported by the connected client. The published 4.1.4 contract does not use the older Device.Info gateway:

var powerSource = Device.Battery.PowerSource;
bool isFirstLaunchEver = Device.Versioning.IsFirstLaunchEver;
string cacheDirectory = Device.FileSystem.CacheDirectory;

For dynamically registered extensions, request the Wisej-facing information type, not the native provider type. For example, with Authentication configured as described in Extensions:

var authenticationType = Device
.Use<Wisej.Hybrid.Authentication.DeviceAuthenticationInfo>()
.AuthenticationType;

Properties​

Use the module that owns the setting or capability:

Device.StatusBar.BackColor = System.Drawing.Color.Blue;
bool canComposeEmail = Device.Email.IsComposeSupported;

Reading device-backed properties can require a request to the native client. Keep calls within a connected Hybrid session and handle device failures.

Methods​

Call the module's actual methods; they are not interchangeable with System.IO.File methods:

var path = System.IO.Path.Combine(Device.FileSystem.AppDataDirectory, "MyFile.txt");
Device.FileSystem.WriteText(path, "Hello, World!");

Where a published asynchronous method is available, await it in an async event handler:

private async void openApp_Click(object sender, EventArgs e)
{
if (!Device.Valid) return;
if (await Device.Launcher.CanOpenAsync("lyft://"))
Device.Launcher.Open("lyft://ridetype?id=lyft_line");
}

See Launch External Apps for native scheme configuration and DeviceLauncher for its released methods. Synchronous result-returning operations can wait modally for a client response. Newer error and completion behavior in source branches must not be assumed present in older packages; consult Release Notes.

Events​

Subscribe to the module that publishes the event, for example:

Device.Battery.BatteryInfoChanged += Device_BatteryInfoChanged;
Device.Flyout.ItemSelected += Device_FlyoutItemSelected;

Supply event handlers with signatures matching the installed assembly. Unsubscribe when the view closes or no longer needs updates:

Device.Battery.BatteryInfoChanged -= Device_BatteryInfoChanged;
Device.Flyout.ItemSelected -= Device_FlyoutItemSelected;

For local notifications use DeviceLocalNotification. The separate remote Notifications extension remains work in progress; its source types and delivery gaps are described there.