Scandit 条形码扫描仪在扫描时显示空白相机



>我正在尝试在我的应用程序中实现scandit条形码扫描仪.我下载了它的示例演示,它工作正常。

我尝试在我的应用程序中实现的相同代码,但它在扫描时显示黑屏。 我也给了相机访问权限。找不到任何缺少的东西。

如果有人也遇到同样的问题,请提供帮助。 任何建议最值得赞赏。 提前致谢

这是我的代码

using FormBot.ViewModels.Abstract;
using Scandit.BarcodePicker.Unified;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using Xamarin.Forms;
namespace FormBot.ViewModels
{
public class SerialNumberViewModel: BaseViewModelDemo
{
private string _recognizedCode;
public ICommand StartScanningCommand => new Command(async () => await StartScanning());
public string RecognizedCode
{
get
{
return (_recognizedCode == null) ? "" : "Code scanned: " + _recognizedCode;
}
set
{
_recognizedCode = value;
}
}
public SerialNumberViewModel()
{
ScanditService.ScanditLicense.AppKey = "Key";
ScanditService.BarcodePicker.DidScan += BarcodePickerOnDidScan;
}
private async void BarcodePickerOnDidScan(ScanSession session)
{
RecognizedCode = session.NewlyRecognizedCodes.LastOrDefault()?.Data;
await ScanditService.BarcodePicker.StopScanningAsync();
}
private async Task StartScanning()
{
await ScanditService.BarcodePicker.StartScanningAsync(false);
}
}

}

在 app.xaml 中.cs

private static string appKey = "key";
ScanditService.ScanditLicense.AppKey = appKey;

AndroidManifest.xml文件中设置android:hardwareAccelerated="true"对我有用。

最新更新