How To Use Xamarin.Forms To Use Datalogic Android SDK

Hello.

I need to develop an application for Datalogic Memor 1 device (Handheld device that has android oreo and 1d laser integrated barcode scanner.)

They have a tutorial to use SDK with Xamarin. datalogic.github.io/xamarin/quick-start/

But their sample is Xamarin.Android project, not Xamarin.Forms. Is it possible to use barcode scanning feature from Xamarin.Forms only ? How can i integrate that to Xamarin.Forms?

Best Answer

  • AlessandroCaliaroAlessandroCaliaro IT ✭✭✭✭✭
    Accepted Answer

    you sould have this on your MainActivity

        void IReadListener.OnRead(IDecodeResult decodeResult)
        {
    
            MessagingCenter.Send<App, string>((App)Xamarin.Forms.Application.Current, "Barcode", decodeResult.Text);
    
        }
    

    And in your XF, somewhere you should have

                    MessagingCenter.Subscribe<App, string>(this, "Barcode", async (sender, thebarcode) => {
    
            // Use here the barcode
    
                    });
    

Answers

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    You have to do all the things in Xamarin android then there should be an event when the app receive the barcode. There you can send a message to XF projectmwith your data
  • ahmetkocadoganahmetkocadogan USMember ✭✭

    @AlessandroCaliaro said:
    You have to do all the things in Xamarin android then there should be an event when the app receive the barcode. There you can send a message to XF projectmwith your data

    Is there any tutorial how to do that ?

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    Accepted Answer

    you sould have this on your MainActivity

        void IReadListener.OnRead(IDecodeResult decodeResult)
        {
    
            MessagingCenter.Send<App, string>((App)Xamarin.Forms.Application.Current, "Barcode", decodeResult.Text);
    
        }
    

    And in your XF, somewhere you should have

                    MessagingCenter.Subscribe<App, string>(this, "Barcode", async (sender, thebarcode) => {
    
            // Use here the barcode
    
                    });
    
  • ahmetkocadoganahmetkocadogan USMember ✭✭

    @&gt; @AlessandroCaliaro said:

    you sould have this on your MainActivity

        void IReadListener.OnRead(IDecodeResult decodeResult)
        {
    
            MessagingCenter.Send<App, string>((App)Xamarin.Forms.Application.Current, "Barcode", decodeResult.Text);
    
        }
    

    And in your XF, somewhere you should have

                    MessagingCenter.Subscribe<App, string>(this, "Barcode", async (sender, thebarcode) => {
    
          // Use here the barcode
    
                    });
    

    Thank you so much. I uploaded my sample project to GitHub, github.com/ahmetkocadogan/XamarinFormsDatalogicSDKExample

    If someone finds this page, I want to help them too.

Sign In or Register to comment.