Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Print in Epson TM-U220 with Xamarin

cmasdevcmasdev PYMember ✭✭
edited May 2015 in Xamarin.Android

Hi everyone, I have a problem with my printer (USB). I followed all documentation but I'm missing something. I can't make it work.
I have two Xamarin's projects.

  1. Android Java Bindings Library with the following tree structure:
    a. Jars/EPOS-Print.jar
    b. libs/armeabi/libeposprint.so

  2. Android Application, that calls to that JBL project. I have the following lines of code:

    using Com.Epson.Epsonio;
    using Com.Epson.Eposprint;
    
    namespace EpsonPrint
    {
        [Activity(Label = "EpsonPrint", MainLauncher = true, Icon = "@drawable/icon")]
        public class MainActivity : Activity
        {
            static Print printer = null;
            string openDeviceName = string.Empty;
            int connectionType = Print.DevtypeUsb;
            int language = Builder.LangEn;
            String printerName = "TM-U220";
    
            Print getPrinter(){
                return printer;
            }
    
            protected override void OnCreate(Bundle savedInstanceState)
            {
                base.OnCreate(savedInstanceState);
    
                //Java.Lang.JavaSystem.Load("libs/armeabi/libeposprint.so"); //This line of code fails because 'libhoudini.so' is missing???
    
               SetContentView(Resource.Layout.Main);
    
               Button button = FindViewById<Button>(Resource.Id.myButton);
    
               Finder.Start(BaseContext, DevType.Usb, "null"); //BOOM!
    
               button.Click += delegate
               {
    
               };
           }
        }
    }  
    

    Can anyone helps me?

Answers

  • cmasdevcmasdev PYMember ✭✭

    Anyone?
    I have an EpsonIoException Exception.

    Now the problem is with .so file. The system (android) cannot find the file.

  • cmasdevcmasdev PYMember ✭✭

    Any developer couldn't help so there is no solution to this on Xamarin.Android.

  • MatthieuFilionMatthieuFilion CAMember, University

    Hi,

    First of all, I don't have any knowledge about the ePOS-Print SDK, but is there a reason why the last parameter of Finder.Start() is in quotes ?
    According to the Android example coming with the SDK, it should simply be null.
    Unless there is something different when using the SDK with Xamarin.

    Hope that helps

  • Hello, Cristian, you found a solution? I have the same problem

  • pepeluchepepeluche MXMember ✭✭

    i have the same problem can anybody helps, any other link

  • cmasdevcmasdev PYMember ✭✭

    This is the code that I used for:

    try
    {
        //Pass ip address and port number
        var sock = new Socket (ip_printer, int.Parse(printer_port));
        oStream = new PrintWriter (sock.OutputStream, true);
    
        //Start printer
        oStream.Write(0x1B);
        oStream.Write(0x0F);
    
        oStream.Print("Test Printer: OK");
    
        // ESC command for remove paper from printer.
        oStream.Write(0x0C);
    
         // ESC command to finish printer job.
         oStream.Write(0x1B);
         oStream.Write(0x40);
    
         // Clear elements
         oStream.Flush ();
         oStream.Close ();
         oStream.Dispose();
         sock.Close ();
         sock.Dispose();
     }
     catch(Exception ex)
     {
         // Throw exception here! 
     }
    

    In this case, I used my phone as WIFI spot connected to Print Server device (connected to the Epson TMU-220).

    Hope it helps

  • pepeluchepepeluche MXMember ✭✭

    muchas gracias amigo

  • SaveSave THMember
    edited December 2017

    Hi i try to connect epson tm-t82
    How could you solved this line
    //Java.Lang.JavaSystem.Load("libs/armeabi/libeposprint.so"); //This line of code fails because 'libhoudini.so' is missing???
    I'm stuck when loading .so file too.

  • dinobdinob USUniversity ✭✭✭

    @cmasdev Hi, can you provide any links/instruction how to integrate this into Xamarin.Forms please? Thanks

Sign In or Register to comment.