BarcodeScanner.GetDefaultAsync()始终返回null [英] BarcodeScanner.GetDefaultAsync() is always returning null

查看:123
本文介绍了BarcodeScanner.GetDefaultAsync()始终返回null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为运行Windows 8的Zebra设备(型号TC700J)在UWP中创建一个简单的应用程序,在其中我利用了内置的条形码扫描仪.

I'm trying to create a simple application in UWP for a Zebra device (Model TC700J) running Windows 8, in which I make use of the built in barcode scanner.

从我发现的内容来看,有很多Zebra教程可用于在Android上进行编程时访问扫描仪,但是对于Windows则没有,因为Microsoft提供了在 Windows中找到的自己的通用条形码扫描仪API. .PointOfService 命名空间.

From what I've found, there's plenty of Zebra tutorials for accessing the scanner when programming on Android, but none for Windows due to the fact that Microsoft provide their own generic barcode scanner API found in the Windows.Devices.PointOfService namespace.

我当前拥有的代码如下:

The code I currently have looks something like this:

BarcodeScanner scanner;
ClaimedBarcodeScanner claimedScanner;    

scanner = await BarcodeScanner.GetDefaultAsync();

if (scanner != null)
{
    claimedScanner = await scanner.ClaimScannerAsync();
}

问题在于,由于 GetDefaultAsync 方法始终返回null,因此if语句永远不会评估为true.

The problem is that the if statement never evaluates to true as the GetDefaultAsync method always returns null.

在这里,似乎有一个答案工作,指出它取决于 GetDefaultAsync 方法的位置.我尝试将其放置在所有建议的位置,但无济于事.

Over here there was an answer that seemed to work, stating that it depends where the GetDefaultAsync method is placed. I've tried to put it in all of the suggested places though and to no avail.

还有另一种方法, BarcodeScanner.FromIdAsync(),该方法基于作为参数发送的条形码扫描仪ID的字符串表示形式返回条形码,但是我不确定这是否有效条形码扫描仪已内置在设备中.

There is another method, BarcodeScanner.FromIdAsync() which returns a barcode based on the string representation of that barcode scanner's id sent as a parameter, but I'm not sure that'd be valid here as the barcode scanner is built into the device.

推荐答案

从Zebra的站点来看,TC700J似乎是Windows 10 Mobile IoT Enterprize OS的型号. 该平台是ARM(Qualcomm snapdragon),而不是Intel x86/x64.

Looking at Zebra's site, TC700J seems to be model number of Windows 10 Mobile IoT Enterprize OS. And the platform is ARM(Qualcomm snapdragon), not Intel x86/x64.

TC70/TC75触摸电脑系列

TC70 / TC75 Touch Computer Series

https://www.zebra.com/us/en/products/mobile-computers/handheld/tc7x-touch-computer-series.html

TC70x操作系统(TC700J)Windows 10 Mobile IoT Enterprise v1.13.02发行说明

TC70x Operating System (TC700J) Windows 10 Mobile IoT Enterprise v1.13.02 Release Notes

https://www.zebra.com/us/en/support-downloads/software/release-notes/operating-system/tc70x-operating-system-v1-13- 02--release-notes.html

例如,如果您的Zebra设备是旧硬件并且Windows Phone 8/8.1正在运行,则Windows Phone似乎不支持Windows.Devices.PointOfService命名空间.

For example, if your Zebra device is old hardware and Windows Phone 8/8.1 is running, Windows Phone does not seem to support Windows.Devices.PointOfService namespace.

在以下文章的评论中对此进行了描述. Windows Phone 8.1:使用相机扫描条形码

It is described in the comment of the following article. Windows Phone 8.1: Scan Barcodes using Camera

如果您的Zebra设备可以更新到Windows 10 Mobile IoT Enterprise,请在执行后进行检查.

If your Zebra device can update to Windows 10 Mobile IoT Enterprise, please check it after doing it.

如果可以更新它,则可以使用Windows 10条形码扫描仪示例.

If you can update it, you can use the barcode scanner sample for Windows 10.

https://github.com/Microsoft/Windows -universal-samples/tree/master/Samples/BarcodeScanner

如果您的设备在Windows 8 x86上运行,由于Windows 8.1支持Windows.Devices.PointOfService命名空间,因此,如果可能,您需要将操作系统更改为Windows 8.1/10.

If your device is running on Windows 8 for x86, since Windows.Devices.PointOfService namespace is supported from Windows 8.1, you need to change the OS to Windows 8.1/10 if possible.

在这种情况下,您可以使用以下或以上(对于Windows10)示例.

In that case you can use following, or above(for Windows10) sample.

用于Windows 8.1的条形码扫描器示例

Barcode scanner sample for Windows 8.1

https://code.msdn.microsoft.com/windowsapps/Barcode-scanner-sample-f39aa411

如果无法更新,请从Windows(电话?)8上的供应商处获取使用BarcodeScanner的软件和文档.

If you can not update it, please get the software and documentation for using BarcodeScanner from the vendor on Windows (Phone?) 8.

这篇关于BarcodeScanner.GetDefaultAsync()始终返回null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆