1 Reply Latest reply on Apr 10, 2018 1:51 PM by Robin West

    Connection BT Speed on Android

    Nicola Lazzara

      Hi to all, i've an PCL App in Xamarin.Forms that must to print a label. The code for printing is the same on Ios and Android but on Android the bold instruction takes more than 25 seconds in Android while on Ios the answer comes in just under 10 seconds :

       

              public async void Print()

              {

                  string zpl = myZpl;

                  string address = PrinterHelper.GetSerialNumber();

                  bool statusForPrintingOK = true;

                  try

                  {

                      IConnection connectionPrint = null;

                      connectionPrint = ConnectionBuilder.Current.Build(address);

       

                      try

                      {

                         connectionPrint.Open();

       

                          IZebraPrinter printer = ZebraPrinterFactory.Current.GetInstance(PrinterLanguage.ZPL, connectionPrint);

                          IPrinterStatus status = printer.CurrentStatus;

       

                          if (status != null)

                          {

                              if (status.IsPaperOut)

                              {

                                  _messagePaper = "\n" + Helper.PrinterPaperFinished;

                                  statusForPrintingOK = false;

                              }

       

                              if (status.IsHeadOpen)

                              {

                                  _messageHeadOpen = "\n" + Helper.PrinterPaparSlotOpen;

                                  statusForPrintingOK = false;

                              }

       

                              if (statusForPrintingOK)

                              {

                                  bool languageSetting = SetPrintLanguage(connectionPrint, lenghtLabelToPrint);

                                  connectionPrint.Write(Encoding.UTF8.GetBytes(zpl));

                              }

                              else

                              {

                                  MessagingCenter.Send<ReprintAndVoid, string>(this, "RePrintFailed", "ReprintFail");

                                  connectionPrint.Close();

                              }

                          }

                          else

                          {

                              ...

                          }

                      }

                      catch (Exception ex)

                      {

                         .....

                      }

                  }

                  catch (Exception e)

                  {

                               .....

       

       

                  }

                  finally

                  {

                          ...

                  }

              }

       

      I use Zebra Imz320 with last firmware. I wrong something? The device is "Samsung Galaxy Tab A6 (SM-T585)" with Android 7.0

       

      Thanks in advance.

       

      Nicola

        • Re: Connection BT Speed on Android
          Robin West

          Hi Nicola,

          The code looks correct from what I'm seeing.  I have noticed that the higher the Bluetooth security is set, the slower the Open command is, so that's something to check.  I would recommend contacting our tech support to see if there are any other things you can do to optimize this.

          The Open() method when run on a ConnectionBuilder connection comes in around 10-13 seconds on my Zebra TC70 with Android 6.0.1 and Samsung S8 with Android 8.0.

          If you get the connection from a DiscoveredPrinter instance, the Open() function only takes about 2 seconds, but that's because most of the connection setup is done during discovery. So it's slower to get your connection object initially, but is quicker to work with when you are properly opening and closing the connection.  See the sample GitHub - Zebra/LinkOS-Xamarin-Samples at ZSDK_DevDemos  for how to do this.