Bluetooth connection problem on iOS using LinkOS Xamarin


Audience
Tags

Unable to to open a Bluetooth connection to the ZQ320 printer on iOS.
Getting an exception: at LinkOS.Plugin.ConnectionImplementation.Open

Submitted by Dennis Chaplin on November 05, 2021 Permalink

Everything was fine until customers started upgrading to the new iOS versions.
So far we see this problem on all iOS devices on iOS 13,14 and 15 versions.

This is the code:
IConnection connection;
try
{
connection = LinkOS.Plugin.ConnectionBuilder.Current.Build($"BT:{connectionString}");
}
catch (Exception e)
{
Logger?.LogError(GetType(), e, "ConnectToPrinter", $"selectedPrinter {Printer?.Name} ConnectionString {Printer?.ConnectionString}");
ReportSingleError($"Cannot create connection to the printer {Printer?.ConnectionString}");
return null;
}

try
{
connection.Open();
return connection;
}
catch (Exception e)
{
Logger?.LogError(GetType(), e, "ConnectToPrinter.Open()",
$"selectedPrinter {Printer?.Name} ConnectionString {Printer?.ConnectionString}");
ReportSingleError($"Cannot open the connection to the printer {Printer?.ConnectionString}");
return null;
}

StackTrace:
at LinkOS.Plugin.ConnectionImplementation.Open () <0x107cc3f50 + 0x000e0> in <8d7e460cb3074051b7ce878ce3d09d03#8f4cd2027c1161842fd57cffbefad8fa>:0
at Mobile.Print.iOS.Zebra.LinkOsDriver.ConnectToPrinter () <0x107caa968 + 0x000ff> in <7a1a98ba83924c4abe7290163fe881aa#8f4cd2027c1161842fd57cffbefad8fa>:0

Submitted by Dennis Chaplin on November 18, 2021 Permalink

It looks like this problem is more iOS version related than hardware related, but I can be wrong. A lot of our clients use similar hardware. However for the last two month we received over 1K exceptions like this and the majority devices are iPhone11,8 or iPad11,2 both running iOS 14 variants, we do see some iPhone12,1 running iOS 15 as well, but not a lot.

Submitted by SSi1 on November 19, 2021 Permalink

Do you use Link-OS SDK for Xamarin v1.1 or v2.15.2634? Would you be able to share a test project that reproduces the issue with ZQ320? What we have observed lately is that the latest iPhone models (such as iPhone 11 Pro, etc.) have caused the drops of the Bluetooth connection from the printers periodically, which is visible from the Bluetooth Settings view on the iPhone where the Settings view refreshes itself once every one minute or so. During the refresh of the Bluetooth Settings, the printers become disconnected and then reconnected a few seconds later. Therefore, we are wondering if the exceptions from your app were caught during the refresh of the Settings. A test project that can recreate the issue would greatly help us to investigate the root cause.