What's the suggested migration path from LinkOS_Xamarin_SDK?

// Expert user has replied.
J Jonathon Minard 5 months 3 weeks ago
194 6 0

We used the LinkOS_Xamarin_SDK NuGet package in our Xamarin.Android and Xamarin.iOS apps to communicate with Zebra printers.  We're now migrating our apps to .NET 8.  It appears that LinkOS_Xamarin_SDK package isn't available to .NET 8.  Zebra.Printer.SDK looks to be the replacement, but its API appears to be vastly different.  Is there a more direct upgrade path, such as new bindings for the Java and Objective C libraries?

Please Register or Login to post a reply

6 Replies

S Steven Si

The Zebra.Printer.SDK NuGet package has moved away from Xamarin to supporting .NET MAUI 8 with the latest release of v3.0.3271. The API themselves have not changed from the previous versions of v2.14.1869 and v2.15.2634, which supported Xamarin. The changes made in v3.0.3271 are mainly underneath the supporting dependences by shifting from .NET Framework 4.7 to .NET MAUI 8. Due to shifting in the dependencies, migrating a Xamarin project to .NET MAUI is not a simple or easy process, because the Xamarin form based implementation and code structure need to be removed or replaced. 

J Jonathon Minard

Thanks.  I get that the Zebra.Printer.SDK NuGet package itself likely hasn't changed much.  My point is that we were using LinkOS_Xamarin_SDK version 1.2.0 instead of Zebra.Printer.SDK.  Was there ever any guide for migrating from LinkOS_Xamarin_SDK to Zebra.Printer.SDK?  For example, this is a valid line when using the Android version of LinkOS_Xamarin_SDK but would be very different when using Zebra.Printer.SDK:

IZebraPrinterConnection connection = new BluetoothPrinterConnection(macAddress);

J Jonathon Minard

After doing some looking around with DotPeek, I eventually found that the changes weren't as drastic as I was thinking on the Android side at least:

  • IZebraPrinterConnection --> Connection
  • BluetoothPrinterConnection --> BluetoothConnection
  • BluetoothPrinterConnection.IsConnected --> BluetoothConnection.Connected
  • IZebraPrinter --> ZebraPrinter
  • IZebraPrinter having properties for FileUtil/etc. --> ZebraPrinter implements those directly

iOS is more problematic since LinkOS_Xamarin_SDK relied more heavily on iOS-specific classes.  Most notably GraphicsUtil.StoreImage used to have an overload which accepts a CGImage, whereas it's looking like I'll need to fetch a Stream now from somewhere.

 

J Jessica Wade

The Zebra.Printer.SDK is the recommended replacement for the LinkOS_Xamarin_SDK package in .NET 8, although the API is different. Zebra provides documentation and samples to help migrate your code, making this the most direct upgrade path. Creating your own bindings for the Java and Objective-C Zebra printer SDKs is an option, but it involves a significant amount of work and maintenance. Alternatively, you could evaluate using the Zebra.Printer.SDK directly in your .NET 8 apps without Xamarin, or rewriting your apps in .NET 8 using a cross-platform framework like Uno Platform or Avalonia. The best approach depends on the complexity of your apps and your willingness to adapt to the new SDK or rewrite your code.

Thanks

Regards

J Jonathon Minard

Unfortunately, for iOS I ultimately had to go back to using a binding for the Objective C ZSDK_API since the iOS version of Zebra.Printer.SDK is far too buggy:

  1. The app can freeze on newer iOS versions (iOS 15.X - 17.5) if you try to do printer operations around the same time as UI operations such as reloading a table view.
  2. Various printer operations are much slower, especially uploading PNGs to the printer.

Plus some smaller annoyances:

  1. Connections requiring a MAC Address instead of a Serial Number is less convenient since iOS hides MAC Addresses from apps, so we were more limited on how users can initially connect to a printer.
  2. The NuGet package appears to depend on the Microsoft.Maui.Graphics NuGet package without it being properly set as a requirement.  And if Microsoft.Maui.Graphics isn't included, trying to upload a PNG fails.  This should either be an explicit requirement, or it shouldn't be a requirement at all seeing that an app can use Microsoft.iOS without MAUI (meaning Xamarin.Forms successor, not Xamarin in general successor) so it's a little odd to have to include a random MAUI package.
L Leonard Church

Migrating from Xamarin to .NET 8 is a significant step, especially when dealing with external SDKs like the LinkOS_Xamarin_SDK used for Zebra printers. As you noted, the LinkOS_Xamarin_SDK is not directly available in .NET 8, and Zebra has moved towards using the Zebra.Printer.SDK for newer .NET platforms. Unfortunately, this does involve a notable change in the API, making the transition less straightforward.
Given the significant API differences, the most stable and future-proof approach would be to migrate to Zebra.Printer.SDK and refactor your code accordingly. While it may require more upfront effort, it aligns with Zebra's ongoing support and future development, ensuring better compatibility and maintenance down the line.

CONTACT
Can’t find what you’re looking for?