com.brother.bms.androidBindingLibrary 1.0.1001-testing

This is a prerelease version of com.brother.bms.androidBindingLibrary.
There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package com.brother.bms.androidBindingLibrary --version 1.0.1001-testing
                    
NuGet\Install-Package com.brother.bms.androidBindingLibrary -Version 1.0.1001-testing
                    
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="com.brother.bms.androidBindingLibrary" Version="1.0.1001-testing" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="com.brother.bms.androidBindingLibrary" Version="1.0.1001-testing" />
                    
Directory.Packages.props
<PackageReference Include="com.brother.bms.androidBindingLibrary" />
                    
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 com.brother.bms.androidBindingLibrary --version 1.0.1001-testing
                    
#r "nuget: com.brother.bms.androidBindingLibrary, 1.0.1001-testing"
                    
#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.
#addin nuget:?package=com.brother.bms.androidBindingLibrary&version=1.0.1001-testing&prerelease
                    
Install com.brother.bms.androidBindingLibrary as a Cake Addin
#tool nuget:?package=com.brother.bms.androidBindingLibrary&version=1.0.1001-testing&prerelease
                    
Install com.brother.bms.androidBindingLibrary as a Cake Tool

Readme

What is this library?

This is a library that takes the Brother SDK for Android and binds it in a library that users of .NET MAUI can consume

How to use this library

In your android code, import the library com.brother.sdk.lmprinter

RJPrintSettings rjPrintSettings = new(PrinterModel.Rj4250wb)
{
    HalftoneThreshold = 128,
    Rotate180degrees = false,
    WorkPath = PrivateStorage(CommonStrings.WORKPATH), //See Requirements below for details and method body
};

Android.Bluetooth.BluetoothAdapter? btAdapter = Bluetooth.BTAdapter();

Channel printerChannel = Channel.NewBluetoothChannel("macAddressOfPrinter",btAdapter);

var printResult = ImagePrinting(channel,"locationOfThingToPrint",rjPrintSettings);


private static string ImagePrinting(Channel? printerChannel, string ThingToPrint, IPrintSettings printSettings)
{
    PrinterDriverGenerateResult? PrinterDriverGenerateResult = PrinterDriverGenerator.OpenChannel(printerChannel);
    OpenChannelError? printerDriverError = PrinterDriverGenerateResult?.Error;
    OpenChannelError.ErrorCode? driverErrorCode = printerDriverError?.Code;
    Debug.WriteLine("Driver Error: " + driverErrorCode?.ToString() ?? "Driver Error is null");

    // There was no error
    if (driverErrorCode is not null && driverErrorCode.Equals(OpenChannelError.ErrorCode.NoError))
    {
        if (PrinterDriverGenerateResult is not null)
        {
            PrinterDriver? _PrinterDriver = PrinterDriverGenerateResult.Driver;

            // TODO: This is only going to work if the file is in local storage.
            string imagePath = Path.Combine(FileSystem.Current.AppDataDirectory, ThingToPrint);
            if (_PrinterDriver is not null)
            {
                PrintError? PrintResult = _PrinterDriver.PrintImage(imagePath, printSettings);

                _PrinterDriver.CloseChannel();
                if (PrintResult is not null)
                {
                    // If there's an error with printing
                    if (!PrintResult.ToString().Equals(PrintError.ErrorCode.NoError))
                        return string.Concat("Print Error PDF Print: ", PrintResult.ToString());
                    else return PrintResult.ToString();
                }
                else return "Error in PrintImage";
            }
            else return "Printer Driver error";
        }
        else return "Open Channel Failed";
    }
    else return driverErrorCode?.ToString() ?? "Printer Driver Error";
}

Requirements

You MUST set workpath before printing.

public static string? PrivateStorage(string location)
{
    AndroidOS.Content.Context context = AndroidOS.App.Application.Context;
    Java.IO.File? filesDir = context.GetExternalFilesDir(location);
    return filesDir?.ToString();
}
//Example
RJPrintSettings rjPrintSettings = new(PrinterModel.Rj4250wb)
{
    HalftoneThreshold = 128,
    Rotate180degrees = false,
    WorkPath = PrivateStorage(CommonStrings.WORKPATH),
};

Resources

Brother Print SDK Manual

https://support.brother.com/g/s/es/htmldoc/mobilesdk/index.html

BMS Website

https://brothermobilesolutions.com/

Contact Information

E-mail us: bmsdevsupport@brother.com

SDK Version

This library binding is completed against SDK version 4.9.1

Product Compatible and additional computed target framework versions.
.NET net8.0-android34.0 is compatible.  net9.0-android was computed.  net9.0-android35.0 is compatible.  net10.0-android was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.4091 0 6/4/2025
1.0.4091 1 6/4/2025
1.0.1002-alpha 1 6/4/2025

releaseNotes.md