Cross Platform Development

You can use any cross platform development tool if it supports using 3rd party's native libraries.

Xamarin

Xamarin is a one of cross platform development tool which supports native libraries via bindings. The outline is as follows. See Xamarin's documents for more details.

Bind the SDK for iOS

  1. Create a Xamarin.iOS binding library project
  2. Add BRPtouchPrinterKit.framework as a Native Reference to embed it
  3. Bind to BRPtourhPrinterKit.framework writing the API definition file ApiDefinition.cs and the types file StructsAndEnums.cs which can be generated using Objective Sharpie, Xamarin's command line tool
  4. Create a Xamarin.iOS application project
  5. Add the binding library project as a Reference
  6. Write any code using SDK through the binded API in ApiDefinition.cs and StructsAndEnums.cs

Bind the SDK for Android

  1. Create a Xamarin.Android binding library project
  2. Add BrotherPrintLibrary.aar to Jars folder of the project
  3. Customize the binding writing Transforms/Metadata.xml to avoid some naming conflict
  4. Create a Xamarin.Android application project
  5. Add the binding library project as a Reference
  6. Write any code using the SDK through the API under the namespace Com.Brother.Ptouch.Sdk

Transforms/Metadata.xml example:

<?xml version="1.0" encoding="UTF-8"?>
<metadata>
    <attr path="/api/package[@name='com.brother.ptouch.sdk']/class[@name='PrinterInfo']/field[@name='align']" name="managedName">EsAlign</attr>
    <attr path="/api/package[@name='com.brother.ptouch.sdk']/class[@name='PrinterInfo']/field[@name='checkPrintEnd']" name="managedName">EsCheckPrintEnd</attr>
    <attr path="/api/package[@name='com.brother.ptouch.sdk']/class[@name='PrinterInfo']/field[@name='halftone']" name="managedName">EsHalftone</attr>
    <attr path="/api/package[@name='com.brother.ptouch.sdk']/class[@name='PrinterInfo']/field[@name='margin']" name="managedName">EsMargin</attr>
    <attr path="/api/package[@name='com.brother.ptouch.sdk']/class[@name='PrinterInfo']/field[@name='orientation']" name="managedName">EsOrientation</attr>
    <attr path="/api/package[@name='com.brother.ptouch.sdk']/class[@name='PrinterInfo']/field[@name='paperSize']" name="managedName">EsPaperSize</attr>
    <attr path="/api/package[@name='com.brother.ptouch.sdk']/class[@name='PrinterInfo']/field[@name='pjFeedMode']" name="managedName">EsPjFeedMode</attr>
    <attr path="/api/package[@name='com.brother.ptouch.sdk']/class[@name='PrinterInfo']/field[@name='port']" name="managedName">EsPort</attr>
    <attr path="/api/package[@name='com.brother.ptouch.sdk']/class[@name='PrinterInfo']/field[@name='printMode']" name="managedName">EsPrintMode</attr>
    <attr path="/api/package[@name='com.brother.ptouch.sdk']/class[@name='PrinterInfo']/field[@name='printQuality']" name="managedName">EsPrintQuality</attr>
    <attr path="/api/package[@name='com.brother.ptouch.sdk']/class[@name='PrinterInfo']/field[@name='pjPaperKind']" name="managedName">EsPjPaperKind</attr>
</metadata>