Bluetooth connection problem on iOS using LinkOS Xamarin

// Expert user has replied.
D Dennis Chaplin 3 years ago
16 5 0

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

Please Register or Login to post a reply

5 Replies

S Steven Si

Can you share the code snippet and the exception trace?

D Dennis Chaplin

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

S Steven Si

From the code snippet, there is nothing out of ordinary. Does this issue happen on the latest iOS devices, such as iPhone 11 Pro, iPhone 12 Pro or iPhone SE?

D Dennis Chaplin

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.

S Steven Si

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.