BradyCorp.Maui.SDK 3.0.0

dotnet add package BradyCorp.Maui.SDK --version 3.0.0                
NuGet\Install-Package BradyCorp.Maui.SDK -Version 3.0.0                
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="BradyCorp.Maui.SDK" Version="3.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BradyCorp.Maui.SDK --version 3.0.0                
#r "nuget: BradyCorp.Maui.SDK, 3.0.0"                
#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.
// Install BradyCorp.Maui.SDK as a Cake Addin
#addin nuget:?package=BradyCorp.Maui.SDK&version=3.0.0

// Install BradyCorp.Maui.SDK as a Cake Tool
#tool nuget:?package=BradyCorp.Maui.SDK&version=3.0.0                

BradyCorp.MAUI.SDK

Everyone wants an easier way to print. Especially in the field, where dollars are attached to minutes. If your apps can’t connect to a Brady printer, here’s the fix: Brady’s Software Development Kit (SDK). With it, your employees can use their own mobile app to print labels. It’s fast. It’s convenient. It’s a seamless way to get your label data to a Brady printer.

This Brady Print SDK .NET MAUI package is a display of what the Brady SDK can achieve. You will then have the ability to discover, connect, and print your desired templates and images with the API. The package also allows you to see over a dozen printer details and allows you to customize how labels print.

If your business wishes to print labels from its own mobile application, this is a perfect example to show how seamless the integration can appear when fully completed!


Setup

To start, you must add the following statement to your MAUI app's .csproj file. This statement is iOS specific and its purpose is to allow Objective-C code to translate properly into C# code inside the binding. Think of this as a permission.

<PropertyGroup>
	<MtouchExtraArgs>--require-pinvoke-wrappers=true</MtouchExtraArgs>
</PropertyGroup>

Next, you must add this package to both the iOS and Android native projects if you are using a MAUI application. To access the library's API, use the following using statements:

- Android: Implementation identical to the native Android SDK [here](https://sdk.bradyid.com/printer_discovery_android/)
- iOS: "using BradySdkMauiIOSWrapper"

Next, intialize a BradySdk object using the constructors:

- Android: Implementation identical to the native Android SDK [here](https://sdk.bradyid.com/printer_discovery_android/)
- iOS: "new BradySdk()"

NOTE: The Maui Binding MUST be implemented for both iOS and Android separately in both native projects. This is due to different constructors and API methods for each platform. You will need to refer to the API documentation of both SDKs at https://sdk.bradyid.com to learn the discrepanies.

NOTE: Usable templates for Android MUST be embedded in Platforms>>Android>>Resources>>raw and marked as an "AndroidResource" in the files "build properties". Usable templates for iOS can be added to Resources>>Raw and marked as "BundleResource" as the Build Action. Currently, we do not support users retrieving files from their device's file system at runtime. This is due to a data conversion issue between languages in the back-end.


For both Android and iOS, you must call any asynchronous API method from a different thread. That might look like this:

Thread connectThread = new Thread(() =>
{
    //FOR IOS
    bool success = BradySdk.Connect(printer);
    //FOR ANDROID
    printerDetails = PrinterDiscovery.ConnectToDiscoveredPrinter(context, printerName, listeners);
});
connectThread.Start();

It is also suggested to wrap any asynchronous API method in a try/catch.

Thread connectThread = new Thread(() =>
{
    try {
        //FOR IOS
        bool success = BradySdk.Connect(printer);
        //FOR ANDROID
        printerDetails = PrinterDiscovery.ConnectToDiscoveredPrinter(context, printerName, listeners);
    }
    catch (Exception e) {
        Console.WriteLine(e.Message);
    }
});
connectThread.Start();
Product Compatible and additional computed target framework versions.
.NET net8.0-android34.0 is compatible.  net8.0-ios17.2 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.0 134 9/11/2024
2.0.0 84 8/6/2024
1.7.0 145 4/25/2024

3.0.0
- Added support for the S3700 printer.
- Added support for the i5300 printer.
- Print Previews now include accurate colors to reflect the installed supply and ribbon.
- Improvements with bitmap monochromization.

2.0.0
- Updated minSdkVersion for Android to 26
- App's with a minSdkVersion below 26 will not be able to connect to any printer if the mobile device is below Android 8
- Updated Android SDK to 2.0.1 (refer to https://sdk.bradyid.com/release_notes_android/ for details)
- Updated iOS SDK to 2.0.0 (refer to https://sdk.bradyid.com/release_notes_android/ for details)
- Updated README with further setup instructions.
- Revamped PlatformExceptions:
- Version 2.0.0 of the Android and iOS included many added exception messages that help the user pinpoint the location of the error and a resolution.
- You may now wrap any API method in a try/catch block to catch SdkApiExceptions.
- iOS Changes:
- Changed getPrinters() to return a Dictionary with the printer name and how it was discovered.
- Fixed a bug where related parts weren't considered a match (i.e. comparing the supplies "M21-750" and "M21-750-499" should return true).
- Fixed bug where users could not alternate between printing bitmaps and templates. It would print the same label that was set prior.
- TemplateDataNames now returns a Dictionary with the placeholder name mapped to the type of BWS object it is.
- Replaced API methods:
- CheckForPartMismatch with the SuppliesMatch API property.
- Feed() with FeedSupply()
- Cut() with CutSupply()
- GetPreviewBase64String() with GetPreview()

- Added API methods:
- YNumber (property)
- RibbonName (property)
- RibbonRemainingPercentage (property)
- SetAutomaticShutoffTime()
- SetTemplateWithFilePath()
- SetTemplateWithBase64()
- Removed API methods:
- PrinterDetailsString (property)
- SetTemplate()

1.7.0
- The first version of the MAUI wrapper that will be produced internally. This package includes everything supported in the BradyCorp.Xamarin.SDK NuGet package version 1.7.0