4 Replies Latest reply on Feb 14, 2018 7:33 AM by Maurizio Molinari

    Android - problems with socket.connect

    Maurizio Molinari

      Good morning,

      i'm trying to print labels from my custom Android application.

      The problems is that when i try to create a Bluetooth Socket and connect it, i'v receive an Exception:

      IOException: read failed, socket might closed or timeout

      Can anyone help me ?

      Thanks

        • Re: Android - problems with socket.connect
          Robin West

          Hi Maurizio, Many things can cause this exception.  It basically means the system can't find the printer you are telling it to connect to.  I'm going to assume the printer is on and within 30 feet of the Android device.  Some common other things to check are:

          Is Bluetooth setup right on the printer?  Use Printer Setup app to verify.

          Does your app have permission to talk over Bluetooth.  Check the Manifest files in our sample apps to verify you have all the correct permissions.  

          After that, please post some code to show how you are attempting to connect.

          - Robin

            • Re: Android - problems with socket.connect
              Maurizio Molinari

              Hi Robin,

              thanks for answer.

              Manifest si Ok, all the required permissions are inserted in it.

              Like you told, I've triyed to connect to printer via Printer Setup App, and when  I find the printer and try to connect it, App return the following message:

              ' Please check both devices and their settings '.

              What could be the problem ? After this, I think that the problem is not in my source code, but maybe in any setting ? Maybe some cellphone settings instead of the printer?

              Thanks.

                • Re: Android - problems with socket.connect
                  Robin West

                  Hi Maurizio,

                  It's strange that you can find the printer, but not connect to it.  Which printer model are you using?  Which version of Android and what device are you using?

                  Some things to try: 

                  1. Connect the printer to your PC with a USB cable.  Run through the communications setup in the PC version of the Printer Setup application. Set the security level to the minimum - for testing.

                  2. Verify the Bluetooth settings on your phone.  Is it turned on?  Try pairing or verify pairing the printer in the settings there. 

                    • Re: Android - problems with socket.connect
                      Maurizio Molinari

                      Hi Robin,

                      I've solved the problem myself.

                      I explain you:

                      An Android device can connect correcty via bluetooth to a Bluetooth printer only if the printer support the classic mode connection.

                      This information is given from fourth character of second part of Part Number.

                      (Example, on Part Number ZD41022-D0EM00EZ).

                      Part Number can be studied in thi way:

                      If the above char is between A-B-L-W, then the printer supports classic and LE mode.

                      But, if the char is between E-F-M-S, then the printer is only LE mode.

                       

                      So, I couldn't print beacuse my printer is ony LE.

                       

                      Thanks for all.