0

I want to create a simpe UWP barcode scanner application but I am unable to use my built in camera on my Lumia 950 or on my laptop, because PointOfService(POS) API seems to be working only with an external barcode scanner that is connected through USB port. I managed to successfully implement Windows Hello to my application, but to create a barcode scanner looks almost impossible, because there is no proper tutorial on the web. Can you please give me some advice, what API should I use? Because it looks that POS API will not work for me if I want to scan a barcode with built in camera on my devices.

I use BarcodeScanner class for detecion of the barcode scanner on my device. Here is a part of my code where I want to detect a barcode scanner:

BarcodeScanner scanner = await BarcodeScanner.GetDefaultAsync(); 

But i just get message, that no barcode scanner was detected, even if I add pointOfService to

<Capabilities>
    <DeviceCapabilities Name="pointOfService" />
</Capabilities>

Anyone some suggestions how to solve this issue? I searched through the forums but only solution that I found was ZXing API, but I would rather use native Microsoft API than 3rd party solutions, if it is possible. I use Visual Studio 2015.

Terry Warwick
  • 235
  • 2
  • 7
Adrián Molčan
  • 133
  • 1
  • 6
  • I'm not sure about now, A couple of years ago, I found the built-in PointOfService API for UWP to be fairly limited in what kinds of hardware it supported. I ended up using [POS for .NET](https://www.microsoft.com/en-us/download/details.aspx?id=42081), but for your purposes, you might need something newer. – Sam I am says Reinstate Monica Nov 27 '17 at 16:25
  • @SamIam Yes I found this one too, but as you mentioned I need to find some newer API because older ones are not implementable in UWP application as far as i know, but correct me if I am wrong :) I know that there must be some very simple solution, because I do not believe that Microsoft would be that incompetent and forget to create an API for this purpose, but right now I am not able to find any suitable solution – Adrián Molčan Nov 27 '17 at 16:37
  • What I did was make a windows service that used POS for .NET which communicated with the UWP application via a WebAPI endpoint. The reason why you might really _need_ something newer is because pos for .net might no support using a built-in camera as a barcode scanner. You may or may not still have to use this approach. The reason POS for .NET doesn't integrate with UWP is because UWP is sandboxed, it's not necessarily because POS for .NET is old – Sam I am says Reinstate Monica Nov 27 '17 at 19:54
  • @SamIam Well I did not look at this from this point of view, thank you for explanation :) I am quite new in UWP. I just need this application as part of my engineer diploma thesis and I thought that it would be good to use my Lumia phone for this purpose, but I did not expect that it would be that hard to implement built-in camera. I am not surprised that there are not many UWP apps in the Microsoft Store, because even basic things like barcode scanner are this hard to implement and moderators on Microsoft forums just delete my questions, nice attitude from them. Anyway thanks for answer :) – Adrián Molčan Nov 28 '17 at 08:44
  • UWP probably does have support for your camera somewhere, but the PointOfService API might not be the place to look for it. After that, you'd probably do well to use that ZXing library you mentioned because it's algorithm is probably better at getting barcodes from images than anything you'd code up from scratch. – Sam I am says Reinstate Monica Nov 28 '17 at 15:23
  • @SamIam Well, after all it seems, that I have no other option right now than to use that ZXing API, I will give it a try. But anyway I will also search for native Microsoft API that will give me an option to implement built-in camera. I just do not believe that MS developers would omit such a trivial thing, but they have hidden it pretty good. – Adrián Molčan Nov 28 '17 at 20:16

1 Answers1

0

Ok, it was pretty easy to implement ZXing API, now I get it working as it is supposed to work. There is very nice example how to implement barcode scanner with ZXing API, it is really worth of try.

https://zxingnet.codeplex.com/SourceControl/latest#trunk/Clients/WindowsRTDemo/Package.appxmanifest

So problem solved :)

Adrián Molčan
  • 133
  • 1
  • 6