Scandit 条码扫描器在扫描时显示空白相机
Scandit Barcode Scanner Shows Blank camera on scanning
我正在尝试在我的 application.i 中实施 scandit 条形码扫描器,下载了它的示例演示并且工作正常。
我试图在我的 app.but 中实现相同的代码,它在扫描时显示黑屏。
我也给了相机访问权限。找不到任何丢失的东西。
如果有人也遇到同样的问题,请帮助。任何建议最感激。
提前致谢
这是我的代码
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"
对我有用。
我正在尝试在我的 application.i 中实施 scandit 条形码扫描器,下载了它的示例演示并且工作正常。
我试图在我的 app.but 中实现相同的代码,它在扫描时显示黑屏。 我也给了相机访问权限。找不到任何丢失的东西。
如果有人也遇到同样的问题,请帮助。任何建议最感激。 提前致谢
这是我的代码
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"
对我有用。