title: TC51 Zebra device barcode scanning problems in Xamarin Forms
body: <p>I'm developing a mobile application with Xamarin Forms and Prism for MVVM structure.
  I have a TC51 Zebra device and I need to intercept the barcode scan event.
  The <a href="http://techdocs.zebra.com/emdk-for-xamarin/latest/api/" rel="nofollow noreferrer">SDK</a> is correctly installed in the project but the online example is for Xamarin.Android, not for Xamarin.Forms.
  I don't know how to send the scanned barcode from Android project to portable project class.</p>
  
  <p>Now I have this "Send call" in MainActivity.cs (Android project):</p>
  
  <pre><code>void scanner_Data(object sender, Scanner.DataEventArgs e)
      {
          ScanDataCollection scanDataCollection = e.P0;
  
          if ((scanDataCollection != null) &amp;&amp; (scanDataCollection.Result == ScannerResults.Success))
          {
              IList &lt;ScanDataCollection.ScanData&gt; scanData = scanDataCollection.GetScanData();
  
              foreach (ScanDataCollection.ScanData data in scanData)
              {
                  Xamarin.Forms.MessagingCenter.Send&lt;Xamarin.Forms.Application, string&gt;((Xamarin.Forms.Application)Xamarin.Forms.Application.Current, "Barcode", data.Data);
  
              }
          }
      }
  </code></pre>
  
  <p>And this code in my ViewModel (Portable project) constructor:</p>
  
  <pre><code>Xamarin.Forms.MessagingCenter.Subscribe&lt;Xamarin.Forms.Application, string&gt;(Xamarin.Forms.Application.Current, "Barcode", (sender, arg) =&gt; { _pageDialogService.DisplayAlertAsync("Test Scan", "Data Received: " + arg, "OK"); });
  </code></pre>
  
  <p>When I try to read a barcode in this page the app crash.</p>
  
  <p>I have also another problem: Now that I included the SDK in the project the app doesn't work in other devices, it crash on startup. I need to have a single application with barcode scanner support for TC51 Zebra devices and camera barcode scanning for other devices without integrated barcode scanner hardware. Is it possible?</p>